public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
@ 2004-09-24 15:40 programm at metrocom dot ru
2004-09-24 15:43 ` [Bug c++/17655] " programm at metrocom dot ru
` (15 more replies)
0 siblings, 16 replies; 17+ messages in thread
From: programm at metrocom dot ru @ 2004-09-24 15:40 UTC (permalink / raw)
To: gcc-bugs
gcc crashes compiling the following code:
(cmdline is g++-3.4 test.cc)
extern "C" {
#include <math.h>
};
template<typename T> void GetFromString()
{
if (HUGE_VAL) {};
// The same result as above
// if (10.0 == HUGE_VAL) {};
};
int main(char argc, char** argv)
{
GetFromString<char>();
};
It reports:
test.cc: In function `void GetFromString() [with T = char]':
test.cc:14: instantiated from here
test.cc:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
g++ -v output:
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.2/specs
Configured with: ../gcc-3.4.2/configure --enable-version-specific-runtime-libs
Thread model: posix
gcc version 3.4.2
Preprocessored source is attached.
--
Summary: g++ getting SEGFAULT compilling the code with HUGE_VAL
comparasions
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: programm at metrocom dot ru
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
2004-09-24 15:43 ` [Bug c++/17655] " programm at metrocom dot ru
@ 2004-09-24 15:43 ` programm at metrocom dot ru
2004-09-24 15:51 ` pinskia at gcc dot gnu dot org
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: programm at metrocom dot ru @ 2004-09-24 15:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From programm at metrocom dot ru 2004-09-24 15:42 -------
Created an attachment (id=7214)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7214&action=view)
Source file
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
@ 2004-09-24 15:43 ` programm at metrocom dot ru
2004-09-24 15:43 ` programm at metrocom dot ru
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: programm at metrocom dot ru @ 2004-09-24 15:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From programm at metrocom dot ru 2004-09-24 15:41 -------
Created an attachment (id=7213)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7213&action=view)
Preprocessed source
Preprocessed source
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
2004-09-24 15:43 ` [Bug c++/17655] " programm at metrocom dot ru
2004-09-24 15:43 ` programm at metrocom dot ru
@ 2004-09-24 15:51 ` pinskia at gcc dot gnu dot org
2004-09-24 17:27 ` bangerth at dealii dot org
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-24 15:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-24 15:50 -------
You cannot do this:
extern "C" {
#include <math.h>
};
But we should not seg fault because of that.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (2 preceding siblings ...)
2004-09-24 15:51 ` pinskia at gcc dot gnu dot org
@ 2004-09-24 17:27 ` bangerth at dealii dot org
2004-09-24 18:08 ` programm at metrocom dot ru
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: bangerth at dealii dot org @ 2004-09-24 17:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-09-24 17:27 -------
It doesn't fail for me with a 3.4 branch snapshot from 20040820.
Can someone reproduce this with a newer or different snapshot?
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (3 preceding siblings ...)
2004-09-24 17:27 ` bangerth at dealii dot org
@ 2004-09-24 18:08 ` programm at metrocom dot ru
2004-09-24 18:11 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: programm at metrocom dot ru @ 2004-09-24 18:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From programm at metrocom dot ru 2004-09-24 18:08 -------
Why extern "C" { #include <math.h> }; construction is prohibited?
What error should I receive from compiler?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (4 preceding siblings ...)
2004-09-24 18:08 ` programm at metrocom dot ru
@ 2004-09-24 18:11 ` pinskia at gcc dot gnu dot org
2004-09-24 18:13 ` programm at metrocom dot ru
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-24 18:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-24 18:11 -------
Because you should never wrap a header with extern "C" as the header can include C++ code too.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (5 preceding siblings ...)
2004-09-24 18:11 ` pinskia at gcc dot gnu dot org
@ 2004-09-24 18:13 ` programm at metrocom dot ru
2004-09-24 18:23 ` programm at metrocom dot ru
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: programm at metrocom dot ru @ 2004-09-24 18:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From programm at metrocom dot ru 2004-09-24 18:13 -------
To bangerth@dealii.org:
Have you try to compile the preprocessed source, test1.cc?
It seems to me, the problem is releated to the expansion of
HUGE_VAL macro which can be system-dependent (for ex., I use
linux 2.2 kernel on my system):
template<typename T> void GetFromString()
{
if ((__extension__ ((union { unsigned char __c[8]; double __d; }) { __c: {
0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }).__d)) {};
};
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (6 preceding siblings ...)
2004-09-24 18:13 ` programm at metrocom dot ru
@ 2004-09-24 18:23 ` programm at metrocom dot ru
2004-09-24 20:36 ` [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition bangerth at dealii dot org
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: programm at metrocom dot ru @ 2004-09-24 18:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From programm at metrocom dot ru 2004-09-24 18:23 -------
To pinskia@gcc.gnu.org:
1) I've removed 'extern "C"' in my test source, but the compiler gets
SEGFAULT again. I also have tried to replace 'extern "C"' by 'include <cmath>'
construction. Nothing changes.
2) It seems to me, I not only can but I even must wrap C-library
include files by 'extern "C"'. (?) 3-rd edition of Straustrup's book
recommends it in 9.2.2 section. Have I mistaken?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (7 preceding siblings ...)
2004-09-24 18:23 ` programm at metrocom dot ru
@ 2004-09-24 20:36 ` bangerth at dealii dot org
2004-09-24 20:46 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: bangerth at dealii dot org @ 2004-09-24 20:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-09-24 20:35 -------
In reply to comment #7:
No I hadn't. I have now, and I can indeed reproduce the failure. Here's
a smaller testcase:
------------------------
template<typename T> void foo() {
if (((union { char __d; }) { 0 }).__d) {}
}
template void foo<char>();
------------------------
This fails with gcc 3.2.3, 3.3.4, and 3.4.2, but not mainline or 2.95.3:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.ii
x.ii: In function `void foo() [with T = char]':
x.ii:5: instantiated from here
x.ii:2: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
It is thus a regression, although one that is fixed on mainline already.
Note that the exact same thing happens if I replace "union" with "struct".
On the other hand, the bug goes away if I move the declaration of the
union/struct to outside the if-clause; this indicates that it has something
to do with the C99 initializer syntax used here.
W.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Known to fail| |3.2.3 3.3.3 3.4.0
Known to work| |2.95 4.0.0
Last reconfirmed|0000-00-00 00:00:00 |2004-09-24 20:35:58
date| |
Summary|g++ getting SEGFAULT |[3.3/3.4 regression] ICE
|compilling the code with |with using a C99 initializer
|HUGE_VAL comparasions |in an if-condition
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (8 preceding siblings ...)
2004-09-24 20:36 ` [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition bangerth at dealii dot org
@ 2004-09-24 20:46 ` pinskia at gcc dot gnu dot org
2004-09-27 13:29 ` programm at metrocom dot ru
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-24 20:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-24 20:46 -------
Fixed on the mainline : Search converges between 2004-06-14-trunk (#466) and 2004-06-16-trunk
(#467).
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr at gcc dot gnu dot org
Keywords| |ice-on-valid-code
Target Milestone|--- |3.4.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (9 preceding siblings ...)
2004-09-24 20:46 ` pinskia at gcc dot gnu dot org
@ 2004-09-27 13:29 ` programm at metrocom dot ru
2004-09-27 13:30 ` programm at metrocom dot ru
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: programm at metrocom dot ru @ 2004-09-27 13:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From programm at metrocom dot ru 2004-09-27 13:29 -------
(In reply to comment #10)
> Fixed on the mainline : Search converges between 2004-06-14-trunk (#466) and
2004-06-16-trunk
> (#467).
Thanks a lot. It really works for me.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (10 preceding siblings ...)
2004-09-27 13:29 ` programm at metrocom dot ru
@ 2004-09-27 13:30 ` programm at metrocom dot ru
2004-09-27 13:34 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: programm at metrocom dot ru @ 2004-09-27 13:30 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From programm at metrocom dot ru 2004-09-27 13:30 -------
I've changed the bug status after compiling and testing latest g++
from cvs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (11 preceding siblings ...)
2004-09-27 13:30 ` programm at metrocom dot ru
@ 2004-09-27 13:34 ` pinskia at gcc dot gnu dot org
2004-11-01 0:47 ` mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-27 13:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-27 13:34 -------
No this is a regression that is still on a release branch.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WORKSFORME |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (12 preceding siblings ...)
2004-09-27 13:34 ` pinskia at gcc dot gnu dot org
@ 2004-11-01 0:47 ` mmitchel at gcc dot gnu dot org
2005-02-12 22:34 ` pinskia at gcc dot gnu dot org
2005-05-19 17:50 ` mmitchel at gcc dot gnu dot org
15 siblings, 0 replies; 17+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-01 0:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-11-01 00:46 -------
Postponed until GCC 3.4.4.
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.3 |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (13 preceding siblings ...)
2004-11-01 0:47 ` mmitchel at gcc dot gnu dot org
@ 2005-02-12 22:34 ` pinskia at gcc dot gnu dot org
2005-05-19 17:50 ` mmitchel at gcc dot gnu dot org
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-12 22:34 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
` (14 preceding siblings ...)
2005-02-12 22:34 ` pinskia at gcc dot gnu dot org
@ 2005-05-19 17:50 ` mmitchel at gcc dot gnu dot org
15 siblings, 0 replies; 17+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:50 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.4 |3.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17655
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2005-05-19 17:49 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-24 15:40 [Bug c++/17655] New: g++ getting SEGFAULT compilling the code with HUGE_VAL comparasions programm at metrocom dot ru
2004-09-24 15:43 ` [Bug c++/17655] " programm at metrocom dot ru
2004-09-24 15:43 ` programm at metrocom dot ru
2004-09-24 15:51 ` pinskia at gcc dot gnu dot org
2004-09-24 17:27 ` bangerth at dealii dot org
2004-09-24 18:08 ` programm at metrocom dot ru
2004-09-24 18:11 ` pinskia at gcc dot gnu dot org
2004-09-24 18:13 ` programm at metrocom dot ru
2004-09-24 18:23 ` programm at metrocom dot ru
2004-09-24 20:36 ` [Bug c++/17655] [3.3/3.4 regression] ICE with using a C99 initializer in an if-condition bangerth at dealii dot org
2004-09-24 20:46 ` pinskia at gcc dot gnu dot org
2004-09-27 13:29 ` programm at metrocom dot ru
2004-09-27 13:30 ` programm at metrocom dot ru
2004-09-27 13:34 ` pinskia at gcc dot gnu dot org
2004-11-01 0:47 ` mmitchel at gcc dot gnu dot org
2005-02-12 22:34 ` pinskia at gcc dot gnu dot org
2005-05-19 17:50 ` 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).