Bug 37275 - [4.4 Regression] ICE when compile libgomp/task.c
Summary: [4.4 Regression] ICE when compile libgomp/task.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P1 normal
Target Milestone: 4.4.0
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2008-08-29 07:49 UTC by macius bat
Modified: 2008-09-26 21:03 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-09-08 12:03:24


Attachments
the preprocessed source (13.09 KB, text/plain)
2008-08-29 07:52 UTC, macius bat
Details

Note You need to log in before you can comment on or make changes to this bug.
Description macius bat 2008-08-29 07:49:36 UTC
gcc (GCC) 4.4.0 20080828 (experimental)

gcc  -g -O2 -march=i686 -fstack-protector -c task.c -o task.o
Comment 1 macius bat 2008-08-29 07:52:29 UTC
Created attachment 16160 [details]
the preprocessed source
Comment 2 Andrew Pinski 2008-09-02 20:39:38 UTC
Can you say what the ICE is?
Comment 3 macius bat 2008-09-03 10:42:27 UTC
[~/tmp]$gcc --version |head -1
gcc (GCC) 4.4.0 20080902 (experimental)

[~/tmp]$gcc -g -O2 -march=i686 -fstack-protector -c task.c -o task.o
/trunk/libgomp/task.c: In function 'GOMP_task':
/trunk/libgomp/task.c:186: internal compiler error: in mem_loc_descriptor, at dwarf2out.c:10098
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 4 Jakub Jelinek 2008-09-03 22:18:18 UTC
What happens here is that there is a variable (task) initialized from
a value within thread local aggregate (gomp_tls_data.task) and it is never modified, and as i386 has very few registers and register preassure is high,
its pseudo is replaced by equiv mem, which happens to be:
    (mem/s/f/c:SI (plus:SI (plus:SI (unspec:SI [
                    (const_int 0 [0x0])
                ] 18)
            (reg:SI 3 bx [168]))
        (const_int 36 [0x24])) [16 gomp_tls_data.task+0 S4 A32])
(the unspec there is thread pointer).  This is then what dwarf2out sees and
fails on gcc_unreachable, because it doesn't handle that UNSPEC.
Comment 5 Jakub Jelinek 2008-09-26 21:00:26 UTC
Subject: Bug 37275

Author: jakub
Date: Fri Sep 26 20:59:03 2008
New Revision: 140712

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140712
Log:
	PR middle-end/37275
	* dwarf2out.c (tls_mem_loc_descriptor): New function.
	(mem_loc_descriptor): Use it for MEM.  For PLUS fail if second
	mem_loc_descriptor failed.  Accept UNSPEC.
	(loc_descriptor): Use tls_mem_loc_descriptor for MEM.  For PARALLEL
	fail if one of the loc_descriptor calls for pieces failed.
	(loc_descriptor_from_tree_1): Handle even DECL_EXTERNAL __thread vars,
	as long as they bind locally.  For COMPONENT_REF, ARRAY_REF etc. fail
	if loc_descriptor_from_tree_1 on offset failed.

	* gcc.target/i386/pr37275.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr37275.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 Jakub Jelinek 2008-09-26 21:03:16 UTC
Fixed.