Bug 26865 - [4.1 Regression] Segmentation fault with -std=c99 -O1 and alloca()
Summary: [4.1 Regression] Segmentation fault with -std=c99 -O1 and alloca()
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P1 normal
Target Milestone: 4.1.1
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-03-25 05:54 UTC by Flash Sheridan
Modified: 2006-04-26 13:40 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.0 4.0.3
Known to fail: 4.1.0
Last reconfirmed: 2006-04-19 16:23:41


Attachments
Preprocessed Delta-reduced source file (1.16 KB, text/plain)
2006-03-25 05:56 UTC, Flash Sheridan
Details
Pre-processed source (13.04 KB, text/plain)
2006-03-25 05:56 UTC, Flash Sheridan
Details
Original source (5.01 KB, text/plain)
2006-03-25 05:57 UTC, Flash Sheridan
Details
Original header (1.27 KB, text/plain)
2006-03-25 05:57 UTC, Flash Sheridan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Flash Sheridan 2006-03-25 05:54:47 UTC
The attached preprocessed files, 122593_genksyms_min.i and its Delta-reduction 122593_genksyms_min.i, cause a segfault for checking=all builds of GCC 4.1.0 on both Ubuntu 5.04 and OSX 10.4.5 with -std=c99 and -O1.  The original .c and .h files from the Linux kernel distribution (which I'll also attach) crash on Ubuntu but not OSX.  Ubuntu issues warnings before crashing, whereas OSX compiles cleanly, which suggests a header problem.  A checking=all build of 4.0.2 compiles all three versions of the file with warnings but no error, as does a checking build of GCC 3.4.3; so this is a regression.  

Here's the session:

48> /opt/gcc410-chk-all/bin/gcc -v  -std=c99 -O1 ../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i
Using built-in specs.
Target: powerpc-apple-darwin8.5.0
Configured with: /opt/Gcc-4.1.0-dist/configure --enable-checking=all --prefix=/opt/gcc410-chk-all --enable-languages=c,c++ --with-comment=PalmSource checking=all build by Flash Sheridan 3/17/06
Thread model: posix
gcc version 4.1.0
 /opt/gcc410-chk-all/libexec/gcc/powerpc-apple-darwin8.5.0/4.1.0/cc1 -fpreprocessed ../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i -fPIC -quiet -dumpbase 122593_genksyms_min.i -auxbase 122593_genksyms_min -O1 -std=c99 -version -o /var/tmp//cc4PRuEJ.s
GNU C version 4.1.0 (powerpc-apple-darwin8.5.0)
        compiled by GNU C version 4.0.1 (Apple Computer, Inc. build 5247).
GGC heuristics: --param ggc-min-expand=0 --param ggc-min-heapsize=0
Compiler executable checksum: 1116648296470812f723ca4bff2463c0
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:60: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:63: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:66: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:69: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:72: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i: In function 'add_symbol':
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:74: warning: implicit declaration of function 'map_to_ns'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:75: warning: implicit declaration of function 'strlen'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:75: warning: incompatible implicit declaration of built-in function 'strlen'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:75: warning: implicit declaration of function 'memcmp'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:75: warning: implicit declaration of function 'strcmp'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i: At top level:
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:80: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:83: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:86: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:91: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:96: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i: In function 'print_list':
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:101: warning: implicit declaration of function 'alloca'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:101: warning: assignment makes pointer from integer without a cast
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i: At top level:
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:106: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i: In function 'expand_and_crc_list':
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:111: warning: implicit declaration of function 'error_with_pos'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i: At top level:
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:120: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:125: warning: return type defaults to 'int'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:129: warning: conflicting types for 'error_with_pos'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:111: warning: previous implicit declaration of 'error_with_pos' was here
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i: In function 'genksyms_usage':
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:138: warning: implicit declaration of function 'fprintf'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:138: warning: incompatible implicit declaration of built-in function 'fprintf'
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i: In function 'print_list':
../cpp/bugfiles/GCC_bugfiles/error/122593_genksyms_min.i:96: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.



---
PalmSource bug 122593
http://pobox.com/~flash
Quality Lead for Compilers and Debuggers
PalmSource, Inc. Tools Quality Management
Comment 1 Flash Sheridan 2006-03-25 05:56:00 UTC
Created attachment 11120 [details]
Preprocessed Delta-reduced source file
Comment 2 Flash Sheridan 2006-03-25 05:56:42 UTC
Created attachment 11121 [details]
Pre-processed source
Comment 3 Flash Sheridan 2006-03-25 05:57:10 UTC
Created attachment 11122 [details]
Original source
Comment 4 Flash Sheridan 2006-03-25 05:57:40 UTC
Created attachment 11123 [details]
Original header
Comment 5 Drea Pinski 2006-03-25 07:24:08 UTC
Backtrace:
#0  0x00000000006fa7ae in find_func_aliases (t=0x2aaaab1483c0, ai=0xb1d9b0)
    at /home/pinskia/src/gcc-4.1/gcc/gcc/tree-ssa-structalias.c:2932
#1  0x00000000006fad8e in compute_points_to_sets (ai=0xb1d9b0)
    at /home/pinskia/src/gcc-4.1/gcc/gcc/tree-ssa-structalias.c:3742
#2  0x000000000047c74e in compute_may_aliases () at /home/pinskia/src/gcc-4.1/gcc/gcc/tree-ssa-alias.c:263
#3  0x00000000006e5c66 in execute_one_pass (pass=0xa319a0)
    at /home/pinskia/src/gcc-4.1/gcc/gcc/passes.c:827
#4  0x00000000006e5d5c in execute_pass_list (pass=0xa319a0)
    at /home/pinskia/src/gcc-4.1/gcc/gcc/passes.c:859
Comment 6 Drea Pinski 2006-03-25 22:09:10 UTC
Reduced testcase:
void print_list(void)
{
  char *e;
  e = alloca(100);
}

-----
I wonder if alloca being turned off as a builtin is causing this.
Comment 7 Dinar Temirbulatov 2006-04-19 23:25:27 UTC
this bug could be fixed my backporting this patch:

2005-12-11  Daniel Berlin  <dberlin@dberlin.org>
 
       * timevar.def (TV_IPA_PTA): New.
       * tree-pass.h (pass_ipa_pta): New
       * tree-ssa-structalias.c: Include cgraph.h
Comment 8 Jakub Jelinek 2006-04-25 09:42:48 UTC
Subject: Bug 26865

Author: jakub
Date: Tue Apr 25 09:42:41 2006
New Revision: 113242

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113242
Log:
	PR tree-optimization/26865
	* gcc.dg/pr26865.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr26865.c
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 9 Jakub Jelinek 2006-04-25 09:45:09 UTC
Subject: Bug 26865

Author: jakub
Date: Tue Apr 25 09:45:01 2006
New Revision: 113243

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113243
Log:
	PR tree-optimization/26865
	* tree-ssa-structalias.c (find_func_aliases): Check that anyoffsetrhs
	type is pointer or array type.

	* gcc.dg/pr26865.c: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr26865.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/tree-ssa-structalias.c

Comment 10 Volker Reichelt 2006-04-26 13:40:39 UTC
Fixed on mainline and 4.1 branch.