Bug 37645 - [4.2/4.3/4.4 regression] ICE with weakref attribute
Summary: [4.2/4.3/4.4 regression] ICE with weakref attribute
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.3.3
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2008-09-25 06:53 UTC by Volker Reichelt
Modified: 2008-09-26 05:27 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-09-25 14:36:43


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-09-25 06:53:33 UTC
The following code snippet triggers an ICE since GCC 4.1.0:

==========================================================
void foo(int i __attribute__((__weakref__ ("xyz"))));
==========================================================

bug.c:1: internal compiler error: tree check: expected tree that contains 'decl with visibility' structure, have 'parm_decl' in handle_weakref_attribute, at c-common.c:6162
Please submit a full bug report, [etc.]

Before GCC 4.1.0 the code was accepted with the following warning:

bug.c:1: warning: '__weakref__' attribute directive ignored
Comment 1 Jakub Jelinek 2008-09-26 05:10:51 UTC
Subject: Bug 37645

Author: jakub
Date: Fri Sep 26 05:09:29 2008
New Revision: 140680

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140680
Log:
	PR c/37645
	* c-common.c (handle_weakref_attribute): Ignore the attribute unless
	the decl is a VAR_DECL or FUNCTION_DECL.

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

Added:
    trunk/gcc/testsuite/gcc.dg/pr37645.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/testsuite/ChangeLog

Comment 2 Jakub Jelinek 2008-09-26 05:25:13 UTC
Subject: Bug 37645

Author: jakub
Date: Fri Sep 26 05:23:48 2008
New Revision: 140681

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140681
Log:
	PR c/37645
	* c-common.c (handle_weakref_attribute): Ignore the attribute unless
	the decl is a VAR_DECL or FUNCTION_DECL.

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

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/pr37645.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/c-common.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 3 Jakub Jelinek 2008-09-26 05:27:00 UTC
Fixed.