Bug 35438 - ICE with invalid use of threadprivate
Summary: ICE with invalid use of threadprivate
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: ice-on-invalid-code, monitored, openmp
Depends on:
Blocks:
 
Reported: 2008-03-03 21:06 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 15:07:07


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:06:57 UTC
The following invalid code snippet triggers an ICE since GCC 4.2.0 when
compiled with "-fopenmp":

================================
void foo();
#pragma omp threadprivate(foo)
================================

bug.c:2: internal compiler error: tree check: expected var_decl, have function_decl in c_parser_omp_threadprivate, at c-parser.c:7975
Please submit a full bug report, [etc.]
Comment 1 Jakub Jelinek 2008-03-10 15:07:07 UTC
Testing a fix.
Comment 2 Jakub Jelinek 2008-03-10 19:41:32 UTC
Subject: Bug 35438

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 35438

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:34 UTC
Fixed.