Bug 35439 - ICE using threadprivate for broken variable
Summary: ICE using threadprivate for broken variable
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.3.1
Assignee: Jakub Jelinek
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored, openmp
Depends on:
Blocks:
 
Reported: 2008-03-03 21:10 UTC by Volker Reichelt
Modified: 2008-03-13 08:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-03-10 14:55:40


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-03-03 21:10:27 UTC
The following invalid code snippet triggers an ICE since GCC 4.2.0 when
compiled with "-fopenmp":

================================
void x[1];
#pragma omp threadprivate(x)
================================

bug.c:1: error: declaration of 'x' as array of voids
bug.c:2: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in c_parser_omp_threadprivate, at c-parser.c:7971
Please submit a full bug report, [etc.]

Related to PR35428.
Comment 1 Jakub Jelinek 2008-03-10 14:55:40 UTC
Testing a fix.
Comment 2 Jakub Jelinek 2008-03-10 19:41:30 UTC
Subject: Bug 35439

Author: jakub
Date: Mon Mar 10 19:40:39 2008
New Revision: 133085

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133085
Log:
	PR c/35438
	PR c/35439
	* c-parser.c (c_parser_omp_threadprivate): Don't add vars with
	errorneous type.  Check that v is a VAR_DECL.

	* gcc.dg/gomp/pr35438.c: New test.
	* gcc.dg/gomp/pr35439.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/gomp/pr35438.c
    trunk/gcc/testsuite/gcc.dg/gomp/pr35439.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-parser.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Jakub Jelinek 2008-03-10 20:53:13 UTC
Subject: Bug 35439

Author: jakub
Date: Mon Mar 10 20:52:28 2008
New Revision: 133089

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133089
Log:
	PR c/35438
	PR c/35439
	* c-parser.c (c_parser_omp_threadprivate): Don't add vars with
	errorneous type.  Check that v is a VAR_DECL.

	* gcc.dg/gomp/pr35438.c: New test.
	* gcc.dg/gomp/pr35439.c: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/gomp/pr35438.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/gomp/pr35439.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/c-parser.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2008-03-10 20:57:15 UTC
Fixed.