Bug 49640 - Internal compiler in C99 code (using variable-length arrays) and OpenMP
Summary: Internal compiler in C99 code (using variable-length arrays) and OpenMP
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL:
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2011-07-05 11:48 UTC by doriankrause
Modified: 2011-07-19 19:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-07-07 09:11:25


Attachments
The test code (284 bytes, text/x-csrc)
2011-07-05 11:49 UTC, doriankrause
Details
gcc47-pr49640.patch (942 bytes, patch)
2011-07-07 09:11 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description doriankrause 2011-07-05 11:48:27 UTC
Hello,

the attached code fails to compile with gcc 4.5.0 when enabling OpenMP:

[kraused@cub ~]$ gcc -c -std=gnu99 test.c
[kraused@cub ~]$ gcc -c -std=gnu99 -fopenmp test.c
test.c: In function 'convert_u8_f32.omp_fn.0':
test.c:31:9: internal compiler error: in expand_one_var, at cfgexpand.c:953
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The gcc version is 4.5.0:

[kraused@cub ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/share/apps/gcc/4.5.0/gcc_412/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/share/apps/gcc/4.5.0/gcc_412 --with-mpfr=/share/apps/mpfr/2.4.2/gcc_412 --with-gmp=/share/apps/gmp/5.0.1/gcc_412 --with-mpc=/share/apps/mpc/0.8.2/gcc_412 --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.5.0 (GCC) 


Btw. the code also fails to compile with the 4.1.2 gcc on my RHEL box:

[kraused@icsprec03 ~]$ gcc -c -std=gnu99 -fopenmp convert.c 
convert.c: In function ‘convert_u8_s32.omp_fn.0’:
convert.c:27: internal compiler error: in make_decl_rtl, at varasm.c:893
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccsIbyBy.out file, please attach this to your bugreport.
[kraused@icsprec03 ~]$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)


Unfortunately I don't have a newer gcc available right now for testing.
Comment 1 doriankrause 2011-07-05 11:49:09 UTC
Created attachment 24688 [details]
The test code
Comment 2 Jakub Jelinek 2011-07-07 09:11:25 UTC
Created attachment 24703 [details]
gcc47-pr49640.patch

Untested fix.
Comment 3 Jakub Jelinek 2011-07-07 12:49:21 UTC
Author: jakub
Date: Thu Jul  7 12:49:17 2011
New Revision: 175967

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175967
Log:
	PR middle-end/49640
	* gimplify.c (gimplify_compound_lval): For last 2 ARRAY_*REF
	operands and last COMPONENT_REF operand call gimplify_expr on it
	if non-NULL.

	* gcc.dg/gomp/pr49640.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/gomp/pr49640.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2011-07-07 12:50:08 UTC
Author: jakub
Date: Thu Jul  7 12:50:03 2011
New Revision: 175968

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175968
Log:
	PR middle-end/49640
	* gimplify.c (gimplify_compound_lval): For last 2 ARRAY_*REF
	operands and last COMPONENT_REF operand call gimplify_expr on it
	if non-NULL.

	* gcc.dg/gomp/pr49640.c: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/gomp/pr49640.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/gimplify.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2011-07-07 12:58:22 UTC
Fixed for 4.6/4.7+ so far.
Comment 6 Jakub Jelinek 2011-07-19 13:06:04 UTC
Author: jakub
Date: Tue Jul 19 13:06:00 2011
New Revision: 176455

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176455
Log:
	Backport from mainline
	2011-07-07  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/49640
	* gimplify.c (gimplify_compound_lval): For last 2 ARRAY_*REF
	operands and last COMPONENT_REF operand call gimplify_expr on it
	if non-NULL.

	* gcc.dg/gomp/pr49640.c: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/gomp/pr49640.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/gimplify.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Comment 7 Jakub Jelinek 2011-07-19 19:33:34 UTC
Author: jakub
Date: Tue Jul 19 19:33:30 2011
New Revision: 176486

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176486
Log:
	Backport from mainline
	2011-07-07  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/49640
	* gimplify.c (gimplify_compound_lval): For last 2 ARRAY_*REF
	operands and last COMPONENT_REF operand call gimplify_expr on it
	if non-NULL.

	* gcc.dg/gomp/pr49640.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/gomp/pr49640.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/gimplify.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
Comment 8 Jakub Jelinek 2011-07-19 19:52:03 UTC
Fixed.