Bug 1860854

Summary: gcc segfaults while building dmraid on s390x
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 33CC: aoliva, dmalcolm, fweimer, jakub, jwakely, law, mcsontos, mpolacek, msebor, nickc, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-10.2.1-2.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-12 12:27:13 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: 1863432    

Description Hans de Goede 2020-07-27 08:59:24 UTC
Description of problem:

dmraid fails to build with rawhide gcc versions, both with gcc-10.1.1-2.fc33 and with gcc-10.2.1-1.fc33.

The exact same sources did build fine on s390x with 10.0.1-0.13.fc33. So it seems this is a regression introduced in gcc 10.1.x .

I've tried disabling lto as well as disabling annobin, neither helps.

Here is the error with annobin enabled (the default) :

gcc -c -I. -I../include -I../lib -O2 -flto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -O2 -DDMRAID_NATIVE_LOG -DDMRAID_LED -DDMRAID_TEST -DDMRAID_LED -DDMRAID_INTEL_LED -DHAVE_GETOPTLONG -fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline -DDMRAID_AUTOREGISTER -g -fno-omit-frame-pointer -DDEBUG -D_LARGEFILE64_SOURCE -O2 -DDMRAID_NATIVE_LOG -DDMRAID_LED -DDMRAID_TEST -DDMRAID_LED -DDMRAID_INTEL_LED -DHAVE_GETOPTLONG -fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline -DDMRAID_AUTOREGISTER -g -fno-omit-frame-pointer -DDEBUG -D_LARGEFILE64_SOURCE misc/file.c -o misc/file.o
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_FINISH_UNIT               | annobin: Generate final annotations
PLUGIN_START_UNIT                | annobin: Generate global annotations
PLUGIN_ALL_PASSES_START          | annobin: Generate per-function annotations
PLUGIN_ALL_PASSES_END            | annobin: Register per-function end symbol
during RTL pass: expand
misc/file.c: In function 'read_file':
misc/file.c:80:11: internal compiler error: Segmentation fault
   80 |  else if (rw->func(fd, buffer, size) != size)
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.


I get the exact same error when building without annobin.

Comment 1 Jakub Jelinek 2020-07-27 11:03:00 UTC
Does it go away if you disable LTO (-flto -ffat-lto-objects)?

Comment 2 Hans de Goede 2020-07-27 12:09:31 UTC
No as I already mentioned in the description I've tried both disabling annobin as well as disabling lto. To make sure I have just double checked, here is a s390x scratch-build without lto:

https://koji.fedoraproject.org/koji/taskinfo?taskID=47927557

It fails with the same error as with lto, see:

https://kojipkgs.fedoraproject.org//work/tasks/7894/47927894/build.log

Comment 3 Jakub Jelinek 2020-07-27 12:50:56 UTC
Ah, reproduced now, doesn't seem to be specific to s390x in any way.

Testcase for -O2:

void bar (int, void *) __attribute__((__access__(__read_only__, 2)));

void
foo (void *c)
{
  struct S { void (*fn) (); } f = { bar };
  f.fn (0, c);
}


Started with https://gcc.gnu.org/r10-4929-g54aa6b58fe2fe73bbe67e0485777e0c410a18673

Comment 4 Marian Csontos 2020-07-27 13:39:09 UTC
*** Bug 1860062 has been marked as a duplicate of this bug. ***

Comment 5 Ben Cotton 2020-08-11 13:49:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 6 Hans de Goede 2021-01-12 12:27:13 UTC
This was fixed in gcc-10.2.1-2.fc33; and dmraid has been built succesfully after that, so this bug can be closed now, closing.