public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28991] New: Static constructor emitted instead of initialized variable
@ 2006-09-08 20:52 us15 at os dot inf dot tu-dresden dot de
2006-09-08 21:01 ` [Bug c++/28991] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: us15 at os dot inf dot tu-dresden dot de @ 2006-09-08 20:52 UTC (permalink / raw)
To: gcc-bugs
Instead of emitting an initialized variable in .data at compile time, gcc-4.2.0
emits a variable in .bss and a static constructor to initialize the variable at
run time. This is a regression from previous gcc versions.
Example code:
class T
{
static void (*handler)();
static void func() {};
};
void (*T::handler)() = func;
int main()
{
T t;
return 0;
}
gcc version 4.2.0 20060908 (experimental) emits:
08048416 t global constructors keyed to _ZN1T7handlerE
08049664 B T::handler
4.1.1 and 3.4.6 emit:
0804962c D T::handler
--
Summary: Static constructor emitted instead of initialized
variable
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: us15 at os dot inf dot tu-dresden dot de
GCC build triplet: i486-slackware-linux
GCC host triplet: i486-slackware-linux
GCC target triplet: i486-slackware-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
@ 2006-09-08 21:01 ` pinskia at gcc dot gnu dot org
2006-09-08 21:07 ` adam at os dot inf dot tu-dresden dot de
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-08 21:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-09-08 21:00 -------
Hmm, this worked in "4.2.0 20060821"
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
2006-09-08 21:01 ` [Bug c++/28991] " pinskia at gcc dot gnu dot org
@ 2006-09-08 21:07 ` adam at os dot inf dot tu-dresden dot de
2006-09-09 4:28 ` [Bug c++/28991] [4.2 Regression] " pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: adam at os dot inf dot tu-dresden dot de @ 2006-09-08 21:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from adam at os dot inf dot tu-dresden dot de 2006-09-08 21:07 -------
gcc version 4.2.0 20060903 (experimental) also gives:
080483f2 t global constructors keyed to _ZN1T7handlerE
08049650 B T::handler
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] [4.2 Regression] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
2006-09-08 21:01 ` [Bug c++/28991] " pinskia at gcc dot gnu dot org
2006-09-08 21:07 ` adam at os dot inf dot tu-dresden dot de
@ 2006-09-09 4:28 ` pinskia at gcc dot gnu dot org
2006-09-09 5:03 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-09 4:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-09-09 04:28 -------
(In reply to comment #1)
> Hmm, this worked in "4.2.0 20060821"
But it was broke in "4.2.0 20060831".
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2006-09-09 04:28:47
date| |
Summary|Static constructor emitted |[4.2 Regression] Static
|instead of initialized |constructor emitted instead
|variable |of initialized variable
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] [4.2 Regression] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
` (2 preceding siblings ...)
2006-09-09 4:28 ` [Bug c++/28991] [4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-09-09 5:03 ` pinskia at gcc dot gnu dot org
2006-09-09 5:23 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-09 5:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-09-09 05:03 -------
This looks like it was caused by PR 28588.
In store_init_value, we have a BASELINK.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |28588
Known to fail| |4.2.0
Known to work| |4.1.0 4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] [4.2 Regression] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
` (3 preceding siblings ...)
2006-09-09 5:03 ` pinskia at gcc dot gnu dot org
@ 2006-09-09 5:23 ` pinskia at gcc dot gnu dot org
2006-09-09 5:39 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-09 5:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-09-09 05:23 -------
If we have another function in the overloaded set for the BASELINK:
class T
{
static void (* handler)();
static void func();
static void func(int);
};
void (*T::handler)() = func;
We don't get the initialization functions which means we are not stripping the
BASELINK in one place looking further into the problem.
I think convert_for_initialization is stripping in the case of OVERLOADS while
not in the case of one function.
CCing Mark to see if he has any quick suggestions about the problem.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmitchel at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] [4.2 Regression] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
` (4 preceding siblings ...)
2006-09-09 5:23 ` pinskia at gcc dot gnu dot org
@ 2006-09-09 5:39 ` pinskia at gcc dot gnu dot org
2006-09-10 22:32 ` mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-09 5:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2006-09-09 05:39 -------
I cannot figure out which function should be stripping the BASELINK expression.
OVERLOADS work because perform_implicit_conversion strips it after going
through the overloaded set to figure out which function is correct.
I don't know if store_init_value should do it or some other function.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] [4.2 Regression] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
` (5 preceding siblings ...)
2006-09-09 5:39 ` pinskia at gcc dot gnu dot org
@ 2006-09-10 22:32 ` mmitchel at gcc dot gnu dot org
2006-09-11 0:40 ` mmitchel at gcc dot gnu dot org
2006-09-11 0:42 ` mmitchel at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-09-10 22:32 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mark at codesourcery dot com
|dot org |
Status|NEW |ASSIGNED
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] [4.2 Regression] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
` (6 preceding siblings ...)
2006-09-10 22:32 ` mmitchel at gcc dot gnu dot org
@ 2006-09-11 0:40 ` mmitchel at gcc dot gnu dot org
2006-09-11 0:42 ` mmitchel at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-09-11 0:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from mmitchel at gcc dot gnu dot org 2006-09-11 00:40 -------
Subject: Bug 28991
Author: mmitchel
Date: Mon Sep 11 00:40:15 2006
New Revision: 116838
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116838
Log:
PR c++/28991
* cp-objcp-common.c (cxx_staticp): New function.
* cp-objcp-common.h (LANG_HOOOKS_STATICP): Use it.
* cp-tree.h (cxx_staticp): New function.
PR c++/289991
* g++.dg/init/static3.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/init/static3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-objcp-common.c
trunk/gcc/cp/cp-objcp-common.h
trunk/gcc/cp/cp-tree.h
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/28991] [4.2 Regression] Static constructor emitted instead of initialized variable
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
` (7 preceding siblings ...)
2006-09-11 0:40 ` mmitchel at gcc dot gnu dot org
@ 2006-09-11 0:42 ` mmitchel at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-09-11 0:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from mmitchel at gcc dot gnu dot org 2006-09-11 00:42 -------
Fixed in 4.2.0.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28991
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-09-11 0:42 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-08 20:52 [Bug c++/28991] New: Static constructor emitted instead of initialized variable us15 at os dot inf dot tu-dresden dot de
2006-09-08 21:01 ` [Bug c++/28991] " pinskia at gcc dot gnu dot org
2006-09-08 21:07 ` adam at os dot inf dot tu-dresden dot de
2006-09-09 4:28 ` [Bug c++/28991] [4.2 Regression] " pinskia at gcc dot gnu dot org
2006-09-09 5:03 ` pinskia at gcc dot gnu dot org
2006-09-09 5:23 ` pinskia at gcc dot gnu dot org
2006-09-09 5:39 ` pinskia at gcc dot gnu dot org
2006-09-10 22:32 ` mmitchel at gcc dot gnu dot org
2006-09-11 0:40 ` mmitchel at gcc dot gnu dot org
2006-09-11 0:42 ` mmitchel at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).