This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
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!

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