* [Bug c/29299] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
@ 2006-09-30 16:04 ` pinskia at gcc dot gnu dot org
2006-09-30 16:46 ` jeremy at goop dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-30 16:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-09-30 16:04 -------
Do you have an example code?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/29299] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
2006-09-30 16:04 ` [Bug c/29299] " pinskia at gcc dot gnu dot org
@ 2006-09-30 16:46 ` jeremy at goop dot org
2006-09-30 19:40 ` [Bug middle-end/29299] [4.2 Regresion] " pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeremy at goop dot org @ 2006-09-30 16:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jeremy at goop dot org 2006-09-30 16:46 -------
Created an attachment (id=12360)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12360&action=view)
compile with "gcc -O -S t.c"
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regresion] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
2006-09-30 16:04 ` [Bug c/29299] " pinskia at gcc dot gnu dot org
2006-09-30 16:46 ` jeremy at goop dot org
@ 2006-09-30 19:40 ` pinskia at gcc dot gnu dot org
2006-10-01 23:06 ` mmitchel at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-30 19:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-09-30 19:40 -------
4.1.2 works:
.local bar.1279
.comm bar.1279,4,4
.local bof
.comm bof,4,4
while 4.2.0 does not:
.local bof
.comm bof,4,4
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Component|c |middle-end
Ever Confirmed|0 |1
GCC build triplet|i386-redhat-linux |
GCC host triplet|i386-redhat-linux |
GCC target triplet|i386-redhat-linux |
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2006-09-30 19:40:21
date| |
Summary|gcc "used" attribute has no |[4.2 Regresion] gcc "used"
|effect on local-scope static|attribute has no effect on
|variables |local-scope static variables
Target Milestone|--- |4.2.0
Version|4.1.1 |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regresion] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (2 preceding siblings ...)
2006-09-30 19:40 ` [Bug middle-end/29299] [4.2 Regresion] " pinskia at gcc dot gnu dot org
@ 2006-10-01 23:06 ` mmitchel at gcc dot gnu dot org
2006-10-09 13:05 ` rguenth at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-01 23:06 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regresion] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (3 preceding siblings ...)
2006-10-01 23:06 ` mmitchel at gcc dot gnu dot org
@ 2006-10-09 13:05 ` rguenth at gcc dot gnu dot org
2006-10-15 16:34 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-09 13:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2006-10-09 13:04 -------
We have
bool
decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl)
{
/* If the user told us it is used, then it must be so. */
if (node->externally_visible || node->force_output)
return true;
if (!flag_unit_at_a_time
&& lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
return true;
with "used" set on bar...
Now, the handler for attribute "used" sets DECL_PRESERVE_P on the decl, so
we might as well check that.
Index: cgraph.c
===================================================================
*** cgraph.c (revision 117569)
--- cgraph.c (working copy)
*************** bool
*** 939,948 ****
decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl)
{
/* If the user told us it is used, then it must be so. */
! if (node->externally_visible || node->force_output)
! return true;
! if (!flag_unit_at_a_time
! && lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
return true;
/* ??? If the assembler name is set by hand, it is possible to assemble
--- 939,947 ----
decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl)
{
/* If the user told us it is used, then it must be so. */
! if (node->externally_visible
! || node->force_output
! || DECL_PRESERVE_P (decl))
return true;
/* ??? If the assembler name is set by hand, it is possible to assemble
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2006-09-30 19:40:21 |2006-10-09 13:04:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regresion] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (4 preceding siblings ...)
2006-10-09 13:05 ` rguenth at gcc dot gnu dot org
@ 2006-10-15 16:34 ` pinskia at gcc dot gnu dot org
2006-10-15 17:03 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-15 16:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2006-10-15 16:33 -------
Fixed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regresion] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (5 preceding siblings ...)
2006-10-15 16:34 ` pinskia at gcc dot gnu dot org
@ 2006-10-15 17:03 ` rguenth at gcc dot gnu dot org
2006-10-15 17:32 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-15 17:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from rguenth at gcc dot gnu dot org 2006-10-15 17:03 -------
Not yet for -fno-unit-at-a-time.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regresion] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (6 preceding siblings ...)
2006-10-15 17:03 ` rguenth at gcc dot gnu dot org
@ 2006-10-15 17:32 ` pinskia at gcc dot gnu dot org
2006-10-15 22:33 ` [Bug middle-end/29299] [4.2 Regression] " hubicka at ucw dot cz
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-15 17:32 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regression] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (7 preceding siblings ...)
2006-10-15 17:32 ` pinskia at gcc dot gnu dot org
@ 2006-10-15 22:33 ` hubicka at ucw dot cz
2006-10-18 21:40 ` hubicka at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: hubicka at ucw dot cz @ 2006-10-15 22:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from hubicka at ucw dot cz 2006-10-15 22:33 -------
Subject: Re: [4.2 Regresion] gcc "used" attribute has no effect on local-scope
static variables
> Reopening because it is not fixed for non unit at a time mode (-O0 for C).
-O0 gets it right, just -O1 -fno-unit-at-a-time fails, but I am testing
patch for this already.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regression] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (8 preceding siblings ...)
2006-10-15 22:33 ` [Bug middle-end/29299] [4.2 Regression] " hubicka at ucw dot cz
@ 2006-10-18 21:40 ` hubicka at gcc dot gnu dot org
2006-10-18 21:54 ` hubicka at gcc dot gnu dot org
2007-06-26 11:52 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2006-10-18 21:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from hubicka at gcc dot gnu dot org 2006-10-18 21:40 -------
Subject: Bug 29299
Author: hubicka
Date: Wed Oct 18 21:39:52 2006
New Revision: 117863
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117863
Log:
PR middle-end/29299
* cfgexpand.c (expand_used_vars_for_block): Vars marked used by user
are used.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cfgexpand.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regression] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (9 preceding siblings ...)
2006-10-18 21:40 ` hubicka at gcc dot gnu dot org
@ 2006-10-18 21:54 ` hubicka at gcc dot gnu dot org
2007-06-26 11:52 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2006-10-18 21:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from hubicka at gcc dot gnu dot org 2006-10-18 21:54 -------
Patch for non-unit-at-a-time comitted now.
--
hubicka at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/29299] [4.2 Regression] gcc "used" attribute has no effect on local-scope static variables
2006-09-30 15:00 [Bug c/29299] New: gcc "used" attribute has no effect on local-scope static variables jeremy at goop dot org
` (10 preceding siblings ...)
2006-10-18 21:54 ` hubicka at gcc dot gnu dot org
@ 2007-06-26 11:52 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-06-26 11:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jakub at gcc dot gnu dot org 2007-06-26 11:52 -------
Subject: Bug 29299
Author: jakub
Date: Tue Jun 26 11:52:20 2007
New Revision: 126026
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126026
Log:
2006-10-18 Jan Hubicka <jh@suse.cz>
PR middle-end/29299
* cfgexpand.c (expand_used_vars_for_block): Vars marked used by user
are used.
2006-10-15 Jan Hubicka <jh@suse.cz>
Richard Guenther <rguenther@suse.de>
PR middle-end/29299
* cgraphunit.c (cgraph_finalize_compilation_unit): Call
process_function_and_variable_attributes on all variables, including
those discovered during cgraph construction phase.
* gcc.dg/pr29299.c: New testcase.
Added:
branches/redhat/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr29299.c
Modified:
branches/redhat/gcc-4_1-branch/gcc/ChangeLog
branches/redhat/gcc-4_1-branch/gcc/cfgexpand.c
branches/redhat/gcc-4_1-branch/gcc/cgraphunit.c
branches/redhat/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29299
^ permalink raw reply [flat|nested] 13+ messages in thread