public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19320] New: static const float initialization ignored
@ 2005-01-07 22:41 stefaandr at hotmail dot com
2005-01-07 22:47 ` [Bug c++/19320] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: stefaandr at hotmail dot com @ 2005-01-07 22:41 UTC (permalink / raw)
To: gcc-bugs
This code fails to link (i.e. TOLERANCE is forgotten):
class silhwrap {
void purge_points();
static const float TOLERANCE = 0.3;
};
void silhwrap::purge_points() {
float a = TOLERANCE;
};
int main() {}
Using built-in specs.
Configured with: /esat/alexandria1/stefaan/src/gcc/main/configure --prefix=/esat
/olympia/opt/gcc-4.0 --enable-languages=c,c++
Thread model: posix
gcc version 4.0.0 20050107 (experimental)
/esat/olympia/opt/gcc-4.0/libexec/gcc/i686-pc-linux-gnu/4.0.0/cc1plus -quiet -v
-D_GNU_SOURCE
testi.cpp -quiet -dumpbase testi.cpp -mtune=pentiumpro -auxbase t
esti -version -o /tmp/ccxha7Sc.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-
gnu/4.0.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c
++/4.0.0
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c
++/4.0.0/i686-pc-linux-gnu
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c
++/4.0.0/backward
/esat/olympia/opt/gcc-4.0/include
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/include
/usr/include
End of search list.
GNU C++ version 4.0.0 20050107 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4
.3-0, pie-8.7.7).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
as -V -Qy -o /tmp/ccuxVYdj.o /tmp/ccxha7Sc.s
GNU assembler version 2.15 (i686-pc-linux-gnu) using BFD version 2.15
/esat/olympia/opt/gcc-4.0/libexec/gcc/i686-pc-linux-gnu/4.0.0/collect2 --eh-fra
me-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o testi /usr/lib/crt1.o /
usr/lib/crti.o
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/crtbegi
n.o
-L/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0 -L/esat/olympia/
opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../.. /tmp/ccuxVYdj.o -lstdc++ -l
m -lgcc_s -lgcc
-lc -lgcc_s -lgcc /esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linu
x-gnu/4.0.0/crtend.o /usr/lib/crtn.o
/tmp/ccuxVYdj.o(.text+0x7): In function `silhwrap::purge_points()':
: undefined reference to `silhwrap::TOLERANCE'
collect2: ld returned 1 exit status
[sderoeck@olympia /tmp]# /esat/olympia/opt/gcc-4.0/bin/g++ -v -o testi testi.cpp
Using built-in specs.
Configured with: /esat/alexandria1/stefaan/src/gcc/main/configure
--prefix=/esat/olympia/opt/gcc-4.0 --enable-languages=c,c++
Thread model: posix
gcc version 4.0.0 20050107 (experimental)
/esat/olympia/opt/gcc-4.0/libexec/gcc/i686-pc-linux-gnu/4.0.0/cc1plus -quiet -v
-D_GNU_SOURCE testi.cpp -quiet -dumpbase testi.cpp -mtune=pentiumpro -auxbase
testi -version -o /tmp/ccCQipqK.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/i686-pc-linux-gnu
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/backward
/esat/olympia/opt/gcc-4.0/include
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/include
/usr/include
End of search list.
GNU C++ version 4.0.0 20050107 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1,
ssp-3.4.3-0, pie-8.7.7).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
as -V -Qy -o /tmp/cc0M4nYl.o /tmp/ccCQipqK.s
GNU assembler version 2.15 (i686-pc-linux-gnu) using BFD version 2.15
/esat/olympia/opt/gcc-4.0/libexec/gcc/i686-pc-linux-gnu/4.0.0/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o testi
/usr/lib/crt1.o /usr/lib/crti.o
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/crtbegin.o
-L/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0
-L/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../..
/tmp/cc0M4nYl.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/esat/olympia/opt/gcc-4.0/lib/gcc/i686-pc-linux-gnu/4.0.0/crtend.o /usr/lib/crtn.o
/tmp/cc0M4nYl.o(.text+0x7): In function `silhwrap::purge_points()':
: undefined reference to `silhwrap::TOLERANCE'
collect2: ld returned 1 exit status
--
Summary: static const float initialization ignored
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stefaandr at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19320
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/19320] static const float initialization ignored
2005-01-07 22:41 [Bug c++/19320] New: static const float initialization ignored stefaandr at hotmail dot com
@ 2005-01-07 22:47 ` pinskia at gcc dot gnu dot org
2005-01-07 23:32 ` stefaandr at hotmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-07 22:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-07 22:47 -------
Two things, this is invalid C++ in two different ways, one way is that initializing static constants that
are not integer types is invalid (but is accepted as an extension). The other way is that you still need
supply the memory location for the static constant.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19320
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/19320] static const float initialization ignored
2005-01-07 22:41 [Bug c++/19320] New: static const float initialization ignored stefaandr at hotmail dot com
2005-01-07 22:47 ` [Bug c++/19320] " pinskia at gcc dot gnu dot org
@ 2005-01-07 23:32 ` stefaandr at hotmail dot com
2005-01-08 20:13 ` bangerth at dealii dot org
2005-04-28 2:10 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: stefaandr at hotmail dot com @ 2005-01-07 23:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From stefaandr at hotmail dot com 2005-01-07 23:31 -------
If accepting floats just as integers is an extension, then why does the same
code compile without problems when using integers? (Static integer constants
also need a memory location right? Or don't they?)
btw: is there a document that describes this kind of obvious changes, just like
http://gcc.gnu.org/gcc-3.4/changes.html does for 3.4? I swear I searched the
bug database, but I don't follow the mailing list day by day
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19320
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/19320] static const float initialization ignored
2005-01-07 22:41 [Bug c++/19320] New: static const float initialization ignored stefaandr at hotmail dot com
2005-01-07 22:47 ` [Bug c++/19320] " pinskia at gcc dot gnu dot org
2005-01-07 23:32 ` stefaandr at hotmail dot com
@ 2005-01-08 20:13 ` bangerth at dealii dot org
2005-04-28 2:10 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2005-01-08 20:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2005-01-08 20:13 -------
The fact that it worked for the integer case is by chance, since gcc
seems to have been able to replace all references to that variable
by its value, but it wasn't for the floating point case. That is
often the case since many processors have instructions to load a
certain integer value into a register, but don't have the same
capability for floating point values.
In any case, the standard prescribes that you have to allocate memory for
both cases.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19320
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/19320] static const float initialization ignored
2005-01-07 22:41 [Bug c++/19320] New: static const float initialization ignored stefaandr at hotmail dot com
` (2 preceding siblings ...)
2005-01-08 20:13 ` bangerth at dealii dot org
@ 2005-04-28 2:10 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-28 2:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-28 02:09 -------
*** Bug 21089 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |matz at suse dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19320
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-28 2:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-07 22:41 [Bug c++/19320] New: static const float initialization ignored stefaandr at hotmail dot com
2005-01-07 22:47 ` [Bug c++/19320] " pinskia at gcc dot gnu dot org
2005-01-07 23:32 ` stefaandr at hotmail dot com
2005-01-08 20:13 ` bangerth at dealii dot org
2005-04-28 2:10 ` pinskia 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).