Compiling Lazarus for AArch64 with -O3 creates non-functional code
Original Reporter info from Mantis: crlab @neurolabusc1
-
Reporter name: Chris Rorden
Original Reporter info from Mantis: crlab @neurolabusc1
- Reporter name: Chris Rorden
Description:
This may be related to issue 38053. The current SVN of FPC can build the latest SVN of Lazarus with default settings. However, the same compilation, but with an increased optimization level will compile without incident, but results in an application that will not launch.
Steps to reproduce:
1.) Build Lazarus with an increased optimization level (here are the options in my Tools/ConfigureBuildLazarus menu item, note -O3 causes a failure while resulting code launches with -O2 or lower):
-O3 -FD/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
2.) Launch startlazarus from the terminal to see why the application crashes before a GUI is shown:
Hint: (lazarus) [TBuildManager.SetBuildTarget] Old=aarch64-darwin-cocoa New=aarch64-darwin-cocoa Changed: OS/CPU=True LCL=False
InitOpenedProjectFile select form in designer: GLForm1:TGLForm1 TDesigner
TApplication.HandleException: EBusError
Bus error or misaligned data access
Stack trace:
$6E7953454449541E
$000000010555C06C
$000000010555B9BC
$00000001054F3BFC
$00000001054F2BF0
$00000001054F7820
$0000000105502888
$00000001054F7820
$0000000105729884
$00000001054F7820
$0000000104FB2BD8
$0000000104DE7FF0
$0000000104DD1F08
$0000000104DD5CB8
$0000000104DE7F24
$0000000104B89DF0
$0000000104DDEC64
2020-11-09 07:18:08.268 lazarus[39125:973553] *** Terminating app due to uncaught exception 'NSGenericException', reason: '-[NSAlert runModal] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)'
*** First throw call stack:
(
0 CoreFoundation 0x0000000181611320 __exceptionPreprocess + 240
1 libobjc.A.dylib 0x000000018133fc04 objc_exception_throw + 60
2 CoreFoundation 0x000000018161116c +[NSException exceptionWithName:reason:userInfo:] + 0
3 AppKit 0x000000018447f24c _NSRunModal + 164
4 AppKit 0x0000000183f3a9c8 -[NSAlert runModal] + 272
5 lazarus 0x0000000104d942b0 COCOAINT_$$_COCOAPROMPTUSER$crcF62BAB40 + 1168
6 lazarus 0x0000000104d944c4 COCOAINT$_$TCOCOAWIDGETSET_$__$$_PROMPTUSER$crc484A2DB2 + 52
7 lazarus 0x0000000104d1b47c LCLINTF_$$_PROMPTUSER$crc484A2DB2 + 76
8 lazarus 0x0000000104d1bc88 LCLINTF_$$_PROMPTUSER$crcB76EAC20 + 120
9 lazarus 0x0000000104becccc FORMS$_$TAPPLICATION_$__$$_SHOWEXCEPTION$EXCEPTION + 556
10 lazarus 0x0000000104fa7b84 LCLEXCEPTIONSTACKTRACE$_$TEVENTCONTAINER_$__$$_HANDLEAPPLICATIONEXCEPTION$TOBJECT$EXCEPTION + 292
11 lazarus 0x0000000104bebe88 FORMS$_$TAPPLICATION_$__$$_HANDLEEXCEPTION$TOBJECT + 376
12 lazarus 0x0000000104dc0a94 LCLMESSAGEGLUE_$$_DELIVERMESSAGE$TOBJECT$formal$$INT64 + 324
13 lazarus 0x0000000104dc1338 LCLMESSAGEGLUE_$$_LCLSENDPAINTMSG$TCONTROL$HDC$PPAINTSTRUCT$$INT64 + 72
14 lazarus 0x0000000104dbec28 COCOAWSCOMMON$_$TLCLCOMMONCALLBACK_$__$$_DRAW$NSGRAPHICSCONTEXT$CGRECT$CGRECT + 456
15 lazarus 0x0000000104d96210 -[TCocoaCustomControl drawRect:] + 528
16 AppKit 0x0000000183d4a224 _NSViewDrawRect + 148
17 AppKit 0x000000018447609c -[NSView _recursive:displayRectIgnoringOpacity:inContext:stopAtLayerBackedViews:] + 1300
18 AppKit 0x0000000183d499a4 -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 676
19 QuartzCore 0x000000018769e2dc CABackingStoreUpdate_ + 180
20 QuartzCore 0x00000001876f9d5c ___ZN2CA5Layer8display_Ev_block_invoke + 64
21 QuartzCore 0x000000018769d68c -[CALayer _display] + 1732
22 AppKit 0x0000000183d495fc -[_NSBackingLayer display] + 372
23 AppKit 0x0000000183cba7f8 -[_NSViewBackingLayer display] + 644
24 QuartzCore 0x000000018769c7b4 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 768
25 QuartzCore 0x00000001877bfc08 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 432
26 QuartzCore 0x000000018767af5c _ZN2CA11Transaction6commitEv + 732
27 AppKit 0x0000000183d5e664 __62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke + 304
28 AppKit 0x00000001844acc4c ___NSRunLoopObserverCreateWithHandler_block_invoke + 64
29 CoreFoundation 0x0000000181592df8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
30 CoreFoundation 0x0000000181592c44 __CFRunLoopDoObservers + 576
31 CoreFoundation 0x000000018159219c __CFRunLoopRun + 768
32 CoreFoundation 0x0000000181591730 CFRunLoopRunSpecific + 600
33 HIToolbox 0x0000000188f10f0c RunCurrentEventLoopInMode + 292
34 HIToolbox 0x0000000188f10bcc ReceiveNextEventCommon + 320
35 HIToolbox 0x0000000188f10a6c _BlockUntilNextEventMatchingListInModeWithFilter + 76
36 AppKit 0x0000000183bdfdb0 _DPSNextEvent + 868
37 AppKit 0x0000000183bde730 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1312
38 lazarus 0x0000000104d8a24c -[TCocoaApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 60
39 lazarus 0x0000000104d8a80c COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUNMESSAGES$BOOLEAN$NSDATE + 124
40 lazarus 0x0000000104d8a894 COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPPROCESSMESSAGES + 20
41 lazarus 0x0000000104bebfd4 FORMS$_$TAPPLICATION_$__$$_HANDLEMESSAGE + 52
42 lazarus 0x0000000104bec4b4 FORMS$_$TAPPLICATION_$__$$_RUNLOOP + 68
43 lazarus 0x0000000104d89904 -[TCocoaApplication run] + 52
44 lazarus 0x0000000104d8a780 COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUN$TAPPLICATIONMAINLOOP + 64
45 lazarus 0x0000000104bec458 FORMS$_$TAPPLICATION_$__$$_RUN + 88
46 lazarus 0x0000000104b76a88 PASCALMAIN + 664
47 lazarus 0x0000000104b9e10c FPC_SysEntry + 28
48 lazarus 0x0000000104b767b0 FPC_SYSTEMMAIN + 80
49 libdyld.dylib 0x00000001814b4f54 start + 4
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Mantis conversion info:
- Mantis ID: 38055
- OS: Darwin
- OS Build: 11.0.1 Beta
- Build: 47362
- Platform: Apple Developer Transition Kit
- Version: 3.3.1
- Fixed in revision: 48310 (#e14451c6)
- Monitored by: » @neurolabusc1 (Chris Rorden), » @CuriousKit (J. Gareth Moreton)