public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37949] New: static initialisation through pointer deferred until run time
@ 2008-10-29 10:27 ajrobb at bigfoot dot com
2009-04-16 22:05 ` [Bug c++/37949] " pinskia at gcc dot gnu dot org
2009-04-17 9:18 ` rguenth at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: ajrobb at bigfoot dot com @ 2008-10-29 10:27 UTC (permalink / raw)
To: gcc-bugs
Given various methods for determining byte order on different platforms, the
following can be used in C++ to find the byte order across platforms.
static const uint32_t bytes = 0x03020100ul;
static const unsigned lo = *(const unsigned char*)&bytes;
Unfortunately, the value of 'lo' is determined at pre-run rather than at
compile time.
It would be useful if the compiler could determine the value of 'lo' so as to
eliminate constant logical tests and jumps.
--
Summary: static initialisation through pointer deferred until run
time
Product: gcc
Version: 4.2.4
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ajrobb at bigfoot dot com
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37949
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/37949] static initialisation through pointer deferred until run time
2008-10-29 10:27 [Bug c++/37949] New: static initialisation through pointer deferred until run time ajrobb at bigfoot dot com
@ 2009-04-16 22:05 ` pinskia at gcc dot gnu dot org
2009-04-17 9:18 ` rguenth at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-16 22:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-04-16 22:05 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-04-16 22:05:29
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37949
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/37949] static initialisation through pointer deferred until run time
2008-10-29 10:27 [Bug c++/37949] New: static initialisation through pointer deferred until run time ajrobb at bigfoot dot com
2009-04-16 22:05 ` [Bug c++/37949] " pinskia at gcc dot gnu dot org
@ 2009-04-17 9:18 ` rguenth at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-17 9:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-04-17 09:18 -------
This would be "inlining" of static-initialization-and-destruction functions
if they get optimized to return a constant initializer.
It's not easy to do as they cannot be easily removed late in the compilation.
Of course this particular simple case can be handled by folding.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37949
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-17 9:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-29 10:27 [Bug c++/37949] New: static initialisation through pointer deferred until run time ajrobb at bigfoot dot com
2009-04-16 22:05 ` [Bug c++/37949] " pinskia at gcc dot gnu dot org
2009-04-17 9:18 ` rguenth 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).