Bug 16628 - ilasm crashes on input file
Summary: ilasm crashes on input file
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: IL assembler (show other bugs)
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-12-05 17:53 UTC by Jeff Hardy
Modified: 2016-09-24 10:04 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Example input file (945 bytes, application/octet-stream)
2013-12-05 17:53 UTC, Jeff Hardy
Details

Description Jeff Hardy 2013-12-05 17:53:56 UTC
Created attachment 5613 [details]
Example input file

ilasm crashes when trying to assemble the attached IL input file typeforwarder2.il:

% mono "/Library/Frameworks/Mono.framework/Versions/3.2.4/lib/mono/2.0/ilasm.exe" /NOLOGO /QUIET /DLL /out="typeforwarder2.dll" typeforwarder2.il
typeforwarder2.il (5, 21): 
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.ILASM.ILParser.yyparse (yyInput yyLex) [0x00000] in <filename unknown>:0 
  at Mono.ILASM.ILParser.yyparse (yyInput yyLex, System.Object yyd) [0x00000] in <filename unknown>:0 
  at Mono.ILASM.Driver+DriverMain.ProcessFile (System.String file_path) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.ILASM.ILParser.yyparse (yyInput yyLex) [0x00000] in <filename unknown>:0 
  at Mono.ILASM.ILParser.yyparse (yyInput yyLex, System.Object yyd) [0x00000] in <filename unknown>:0 
  at Mono.ILASM.Driver+DriverMain.ProcessFile (System.String file_path) [0x00000] in <filename unknown>:0

% mono -V                                                                             1 ↵
Mono JIT compiler version 3.2.4 ((no/294f999 Fri Oct 25 20:18:12 EDT 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.3svn-mono)
	GC:            sgen
Comment 1 Alex Earl 2016-09-22 12:40:48 UTC
There is no longer an unhandled exception, but ilasm can't handle the forwarder in the file.

% ilasm --version
Mono ILasm compiler version 4.6.0.0

%mono -V
Mono JIT compiler version 4.6.0 (Stable 4.6.0.245/746756c Wed Sep 14 09:49:13 UTC 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen


$ /usr/bin/ilasm /NOLOGO /QUIET /DLL /out="rowantest.typeforwarder2.dll" Src/typeforwarder2.il
Src/typeforwarder2.il (5, 31) : Error : irrecoverable syntax error

***** FAILURE *****
Comment 2 Alex Earl 2016-09-23 12:07:55 UTC
It looks like the issue is the 'public' in the following:

.class extern public forwarder NSwForwardee2.Foo_SPECIAL{

If that is removed, then the file will assemble correctly.
Comment 3 Alex Earl 2016-09-23 12:43:03 UTC
Looking at the coreclr, ilasm does something slightly different for the attributes.

https://github.com/dotnet/coreclr/blob/775003a4c72f0acc37eab84628fcef541533ba4e/src/ilasm/asmparse.y#L2003
Comment 4 Alex Earl 2016-09-23 15:08:04 UTC
Submitted PR to fix this issue:

https://github.com/mono/mono/pull/3625
Comment 5 Alexander Köplinger [MSFT] 2016-09-24 10:04:54 UTC
The PR was merged, thanks for the contribution!

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Note You need to log in before you can comment on or make changes to this bug.