Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1397948
Summary: | method-to-ir.c miscompiled with -O2 -march=z10 | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Dan Horák <dan> | ||||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||||
Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | unspecified | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | 28 | CC: | chkr, claudiorodrigo, davejohansen, itamar, jakub, jwakely, law, lxtnow, mpolacek, neale, paul, pokorra.mailinglists | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | s390x | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | If docs needed, set a value | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2019-05-28 20:32:40 UTC | Type: | Bug | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 467765 | ||||||||
Attachments: |
|
Description
Dan Horák
2016-11-23 16:07:30 UTC
when running mdoc under gdb: [sharkcz@devel11 docs]$ gdb /home/sharkcz/mono/mono-4.6.2/mono/mini/mono GNU gdb (GDB) Fedora 7.12-29.fc26 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "s390x-redhat-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/sharkcz/mono/mono-4.6.2/mono/mini/mono...done. (gdb) set args ./../class/lib/net_4_x/mdoc.exe --debug assemble -o cs-errors -f error cs-errors.config (gdb) run Starting program: /home/sharkcz/mono/mono-4.6.2/mono/mini/mono ./../class/lib/net_4_x/mdoc.exe --debug assemble -o cs-errors -f error cs-errors.config Missing separate debuginfos, use: dnf debuginfo-install glibc-2.24.90-12.fc26.s390x glibc-2.24.90-13.fc26.s390x [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". [New Thread 0x3fff67ff910 (LWP 4443)] [New Thread 0x3fff4bff910 (LWP 4444)] Thread 1 "Main" received signal SIGSEGV, Segmentation fault. mono_metadata_get_inflated_signature (sig=sig@entry=0x2aa0075e8b0, context=context@entry=0x3f3851ec00000000) at metadata.c:2837 2837 helper.context.class_inst = context->class_inst; (gdb) where #0 mono_metadata_get_inflated_signature (sig=sig@entry=0x2aa0075e8b0, context=context@entry=0x3f3851ec00000000) at metadata.c:2837 #1 0x000002aa0017314a in mono_method_get_signature_checked (method=method@entry=0x3ffffffcf80, image=0x2aa004e8250, image@entry=0x3ffda1fd368, token=token@entry=167772356, context=context@entry=0x3f3851ec00000000, error=error@entry=0x2aa0084cc28) at loader.c:720 #2 0x000002aa0007e8be in mono_method_to_ir (cfg=cfg@entry=0x2aa0084c7a0, method=method@entry=0x2aa0073f7d8, start_bblock=<optimized out>, start_bblock@entry=0x0, end_bblock=0x2aa007f53b0, end_bblock@entry=0x0, return_var=return_var@entry=0x0, inline_args=<optimized out>, inline_offset=<optimized out>, is_virtual_call=<optimized out>) at method-to-ir.c:9319 #3 0x000002aa0011b33e in mini_method_compile (method=method@entry=0x2aa0073f7d8, opts=opts@entry=370223487, domain=domain@entry=0x2aa004231e0, flags=flags@entry=JIT_FLAG_RUN_CCTORS, parts=parts@entry=0, aot_method_index=<optimized out>) at mini.c:3516 #4 0x000002aa0011d346 in mono_jit_compile_method_inner (method=method@entry=0x2aa0073f7d8, target_domain=target_domain@entry=0x2aa004231e0, opt=opt@entry=370223487, error=error@entry=0x3ffffffcf80) at mini.c:4197 #5 0x000002aa00041dca in mono_jit_compile_method_with_opt (method=method@entry=0x2aa0073f7d8, opt=370223487, error=error@entry=0x3ffffffcf80) at mini-runtime.c:1910 #6 0x000002aa00042662 in mono_jit_compile_method (method=method@entry=0x2aa0073f7d8, error=error@entry=0x3ffffffcf80) at mini-runtime.c:1954 #7 0x000002aa000d588e in common_call_trampoline (regs=regs@entry=0x3ffffffd0f0, code=code@entry=0x3fffddb033c "\247\t", m=m@entry=0x2aa0073f7d8, vt=vt@entry=0x0, vtable_slot=<optimized out>, vtable_slot@entry=0x0, error=0x3ffffffcf80) at mini-trampolines.c:702 #8 0x000002aa000d5fbc in mono_magic_trampoline (regs=0x3ffffffd0f0, code=0x3fffddb033c "\247\t", arg=0x2aa0073f7d8, tramp=<optimized out>) at mini-trampolines.c:828 #9 0x000003fffdfe60e2 in ?? () #10 0x000003fffddb033c in ?? () #11 0x000003fffddcf0f8 in ?? () #12 0x000003fffddceeea in ?? () #13 0x000003fffddce874 in ?? () #14 0x000003fffddce6f2 in ?? () #15 0x000003fffddce416 in ?? () #16 0x000003fffdde4000 in ?? () #17 0x000003fffdde381a in ?? () #18 0x000003fffdde34ba in ?? () #19 0x000003fffdde32f2 in ?? () #20 0x000003fffdde323a in ?? () #21 0x000003fffdde2fce in ?? () #22 0x000003fffdde29ee in ?? () #23 0x000003fffdde254e in ?? () #24 0x000003fffddfd010 in ?? () #25 0x000003fffdfd4e30 in ?? () #26 0x000003fffdfd368a in ?? () PC not saved So it's more likely a gcc compiler issue than mono issue. After switching the default optimization for the build from -O2 to -O1 the build passes (no crash in mdoc). The system compiler is gcc-6.2.1-2.fc26.s390x And the fun now begins ... next step - method-to-ir.c is miscompiled with -O2 -mcpu=z10 3 places were identified as requiring -O1 for the mdoc tool to function correctly, the ir-emit.h header with a number of inline functions and macros and the mini_emit_inst_for_method() + link_bblock() functions --- method-to-ir.c.orig 2016-11-14 09:48:51.000000000 +0100 +++ method-to-ir.c 2016-11-24 16:56:19.742489485 +0100 @@ -68,7 +68,9 @@ #include "trace.h" +#pragma GCC optimize("O1") #include "ir-emit.h" +#pragma GCC optimize("O2") #include "jit-icalls.h" #include "jit.h" @@ -547,6 +549,7 @@ MONO_ADD_INS (cfg->cbb, ins); \ } while (0) +#pragma GCC optimize("O1") /* * * link_bblock: Links two basic blocks * @@ -609,6 +612,7 @@ } } +#pragma GCC optimize("O2") void mono_link_bblock (MonoCompile *cfg, MonoBasicBlock *from, MonoBasicBlock* to) { @@ -5969,6 +5973,7 @@ return NULL; } +#pragma GCC optimize("O1") static MonoInst* mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) { @@ -6869,6 +6874,7 @@ return mono_arch_emit_inst_for_method (cfg, cmethod, fsig, args); } +#pragma GCC optimize("O2") /* * This entry point could be used later for arbitrary method * redirection. Created attachment 1223934 [details]
script to reproduce the mdoc call outside the build system
the full command line for the source file should be gcc -DHAVE_CONFIG_H -I. -I../.. -I../../libgc/include -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -DUSE_COMPILER_TLS -I../.. -I../../eglib/src -I../../eglib/src -fvisibility=hidden -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -march=z10 -mtune=z10 -fno-strict-aliasing -std=gnu99 -fno-strict-aliasing -fwrapv -DMONO_DLL_EXPORT -Wno-unused-but-set-variable -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -mbackchain -D__USE_STRING_INLINES -Werror-implicit-function-declaration -c method-to-ir.c -fPIC -DPIC -o .libs/libmini_la-method-to-ir.o Created attachment 1223936 [details]
preprocessed source file
for the record - using -mno-lra doesn't help when compiling the method-to-ir.c file building with gcc7 and the new defaults (-march=zEC12 -mtune=z13) gives same error, the mono package is back on -march=z9-109 -mtune=z10 to be buildable, using -march=z9-109 -mtune=z13 gives even more interesting results This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle. Changing version to '26'. The problem is still here, rechecked with gcc-7.2.1-2.fc26.s390x building mono-4.8.0-12.fc28 This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle. Changing version to '28'. Starting with F-28 (gcc8?) Mono is broken even more on s390x, the workaround is to built with -O1 globally until we know more. This message is a reminder that Fedora 28 is nearing its end of life. On 2019-May-28 Fedora will stop maintaining and issuing updates for Fedora 28. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '28'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 28 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed. For the record - not sure if there was a change in GCC (>=9) or in Mono (more likely), but the problem went away. |