Bug 148934

Summary: cc1 crash building glibc i486 string inlines under -O3
Product: [Fedora] Fedora Reporter: Roland McGrath <roland>
Component: gcc4Assignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 4.0.0-0.33 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-12 00:16:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
preprocessed source to trigger the bug none

Description Roland McGrath 2005-02-17 01:04:02 UTC
Created attachment 111145 [details]
preprocessed source to trigger the bug

Comment 1 Roland McGrath 2005-02-17 01:04:02 UTC
Description of problem:
SIGSEGV

Version-Release number of selected component (if applicable):

I'm actually using upstream gcc trunk as of 2005-02-14.


How reproducible:
100%

Steps to Reproduce:
1.  /usr/local/libexec/gcc/i686-pc-linux-gnu/4.0.0/cc1 -fpreprocessed
string-inlines.i -quiet -dumpbase string-inlines.c -march=i686 -mtune=pentium4
-mpreferred-stack-boundary=2 -auxbase-strip
/home/roland/build/gcc4-libc/string/string-inlines.o -g -O3 -Wall -Winline
-Wstrict-prototypes -Wwrite-strings -std=gnu99 -version -o string-inlines.s

2.
3.
  
Actual results:

GNU C version 4.0.0 20050214 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 3.3.3 20040412 (Red Hat Linux 3.3.3-7).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
../sysdeps/i386/i486/bits/string.h: In function '__strcat_c':
../sysdeps/i386/i486/bits/string.h:1000: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


Expected results:


Additional info:

No crash under -O2.

Comment 2 Jakub Jelinek 2005-02-17 11:02:08 UTC
Simplified testcase at -g -O{1,2,3}:
typedef __SIZE_TYPE__ size_t;

inline void *
foo (void *x, const void *y, size_t z)
{
  register unsigned long int c;
  __asm__ __volatile__ (""
                        : "=&r" (c),
                          "=m" (*(struct { __extension__ char d[z]; } *) x)
                        : "0" (y),
                          "m" (*(struct { __extension__ char d[z]; } *) y));
  return x;
}

char *
bar (char *x, const char y[], size_t z)
{
  foo (x, y, z);
  return x;
}


Comment 3 Jakub Jelinek 2005-02-17 11:04:49 UTC
Even:
inline void *
foo (void *x, unsigned long y)
{
  __asm__ __volatile__ (""
                        : "=m" (*(struct { __extension__ char d[y]; } *) x)
                        : "r" (x));
  return x;
}

char *
bar (char *x, unsigned long y)
{
  foo (x, y);
  return x;
}


Comment 4 Jakub Jelinek 2005-02-17 11:14:34 UTC
This seems to be the same as PR19345.

Comment 5 Jakub Jelinek 2005-03-12 00:16:38 UTC
Should be worked around in gcc-4.0.0-0.33.