public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std
@ 2008-08-29 12:54 paolo dot carlini at oracle dot com
2008-08-29 13:05 ` [Bug c++/37276] " paolo dot carlini at oracle dot com
` (13 more replies)
0 siblings, 14 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-29 12:54 UTC (permalink / raw)
To: gcc-bugs
Hi, I'm getting this annoying run-time Seg-fault for the below. Apparently,
isn't a regression, but really, if we could fix it, the C++ library would
benefit a lot from the fix!
////////////////
namespace my_std
{
inline double
atan(double __x)
{ return __builtin_atan(__x); }
inline double
atanh(double __x)
{ return __builtin_atanh(__x); }
}
namespace std
{
inline double
atan(double __x)
{ return __builtin_atan(__x); }
inline double
atanh(double __x)
{ return __builtin_atanh(__x); }
}
int main()
{
double d;
my_std::atan(.3); // works
my_std::atanh(.3); // works
std::atan(.3); // works
std::atanh(.3); // seg-faults at run-time
}
--
Summary: Trouble with some (C99?) math builtins and namespace std
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: paolo dot carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
@ 2008-08-29 13:05 ` paolo dot carlini at oracle dot com
2008-08-29 13:05 ` paolo dot carlini at oracle dot com
` (12 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-29 13:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2008-08-29 13:04 -------
I think it can be safely confirmed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
2008-08-29 13:05 ` [Bug c++/37276] " paolo dot carlini at oracle dot com
@ 2008-08-29 13:05 ` paolo dot carlini at oracle dot com
2008-08-29 13:09 ` rguenth at gcc dot gnu dot org
` (11 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-29 13:05 UTC (permalink / raw)
To: gcc-bugs
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-08-29 13:04:17
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
2008-08-29 13:05 ` [Bug c++/37276] " paolo dot carlini at oracle dot com
2008-08-29 13:05 ` paolo dot carlini at oracle dot com
@ 2008-08-29 13:09 ` rguenth at gcc dot gnu dot org
2008-08-29 13:13 ` rguenth at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-08-29 13:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2008-08-29 13:08 -------
Funny. (just look at the asm...)
--
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|2008-08-29 13:04:17 |2008-08-29 13:08:02
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (2 preceding siblings ...)
2008-08-29 13:09 ` rguenth at gcc dot gnu dot org
@ 2008-08-29 13:13 ` rguenth at gcc dot gnu dot org
2008-08-29 14:19 ` paolo dot carlini at oracle dot com
` (9 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-08-29 13:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2008-08-29 13:11 -------
Actually, it looks like we treat
namespace std
{
inline double
atanh(double __x)
{ return __builtin_atanh(__x); }
}
as a definition of ::atanh (with C linkage), and emit
atanh:
.LFB0:
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
subq $32, %rsp
.LCFI2:
movsd %xmm0, -8(%rbp)
movsd -8(%rbp), %xmm0
call atanh
movsd %xmm0, -24(%rbp)
movq -24(%rbp), %rax
movq %rax, -24(%rbp)
movsd -24(%rbp), %xmm0
leave
ret
main:
.LFB1:
pushq %rbp
.LCFI3:
movq %rsp, %rbp
.LCFI4:
movsd .LC0(%rip), %xmm0
call atanh
movl $0, %eax
leave
ret
So, this is a frontend bug.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu dot org
AssignedTo|rguenth at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (3 preceding siblings ...)
2008-08-29 13:13 ` rguenth at gcc dot gnu dot org
@ 2008-08-29 14:19 ` paolo dot carlini at oracle dot com
2008-08-29 15:54 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-29 14:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from paolo dot carlini at oracle dot com 2008-08-29 14:18 -------
>From the "outside", without looking deeper, I agree it seems a front-end issue.
The following seg-faults only when built with the C++ compiler:
inline double
atanh(double __x)
{ return __builtin_atanh(__x); }
int main()
{
atanh(.3);
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (4 preceding siblings ...)
2008-08-29 14:19 ` paolo dot carlini at oracle dot com
@ 2008-08-29 15:54 ` pinskia at gcc dot gnu dot org
2008-08-29 15:57 ` paolo dot carlini at oracle dot com
` (7 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-29 15:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2008-08-29 15:52 -------
I think this testcase is invalid without -std=c++98.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (5 preceding siblings ...)
2008-08-29 15:54 ` pinskia at gcc dot gnu dot org
@ 2008-08-29 15:57 ` paolo dot carlini at oracle dot com
2008-08-29 16:03 ` paolo dot carlini at oracle dot com
` (6 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-29 15:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo dot carlini at oracle dot com 2008-08-29 15:56 -------
Why?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (6 preceding siblings ...)
2008-08-29 15:57 ` paolo dot carlini at oracle dot com
@ 2008-08-29 16:03 ` paolo dot carlini at oracle dot com
2008-08-29 16:06 ` paolo dot carlini at oracle dot com
` (5 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-29 16:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo dot carlini at oracle dot com 2008-08-29 16:01 -------
The strict c++98 standard, without GNU extensions, doesn't know anything about
atanh - there isn't a single mention in the entire Standard - therefore I don't
see why any difference is wanted. Even less I see why we want Seg-faults at
run-time. Even less, why we want that in the C++0x era, when C99 math
facilities are on a par with C89 ones.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (7 preceding siblings ...)
2008-08-29 16:03 ` paolo dot carlini at oracle dot com
@ 2008-08-29 16:06 ` paolo dot carlini at oracle dot com
2008-08-29 18:47 ` paolo dot carlini at oracle dot com
` (4 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-29 16:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paolo dot carlini at oracle dot com 2008-08-29 16:05 -------
(In reply to comment #7)
> The strict c++98 standard, without GNU extensions, doesn't know anything about
> atanh - there isn't a single mention in the entire Standard - therefore I don't
> see why any difference is wanted.
Sorry, I got this first part of my reply backward. In any case, I don't think
enabling the GNU extensions (-std=gnu++98 is the default) should lead to such
nasty problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (8 preceding siblings ...)
2008-08-29 16:06 ` paolo dot carlini at oracle dot com
@ 2008-08-29 18:47 ` paolo dot carlini at oracle dot com
2008-08-30 14:26 ` rguenther at suse dot de
` (3 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-29 18:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from paolo dot carlini at oracle dot com 2008-08-29 18:46 -------
FWIW, this kind of contortion appear to work, but really I'd rather prefer not
using it...
namespace my_std
{
inline double
atan(double __x)
{ return __builtin_atan(__x); }
inline double
atanh(double __x)
{ return __builtin_atanh(__x); }
}
namespace std
{
using ::my_std::atan;
using ::my_std::atanh;
}
int main()
{
std::atan(.3); // works
std::atanh(.3); // works
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (9 preceding siblings ...)
2008-08-29 18:47 ` paolo dot carlini at oracle dot com
@ 2008-08-30 14:26 ` rguenther at suse dot de
2009-07-14 14:00 ` paolo dot carlini at oracle dot com
` (2 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: rguenther at suse dot de @ 2008-08-30 14:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenther at suse dot de 2008-08-30 14:25 -------
Subject: Re: Trouble with some (C99?) math builtins and
namespace std
On Fri, 29 Aug 2008, paolo dot carlini at oracle dot com wrote:
> ------- Comment #9 from paolo dot carlini at oracle dot com 2008-08-29 18:46 -------
> FWIW, this kind of contortion appear to work, but really I'd rather prefer not
> using it...
So from the previous replies I gather that if one adds a symbol
to the std:: namespace the new additions are not mangled if their
unmangled name is used by a GNU extension? For what reason?
At least I would miss a warning here that atanh is re-declared in
a different namespace or so.
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (10 preceding siblings ...)
2008-08-30 14:26 ` rguenther at suse dot de
@ 2009-07-14 14:00 ` paolo dot carlini at oracle dot com
2009-07-14 18:16 ` jason at gcc dot gnu dot org
2009-07-14 18:44 ` jason at gcc dot gnu dot org
13 siblings, 0 replies; 16+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-07-14 14:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from paolo dot carlini at oracle dot com 2009-07-14 14:00 -------
Jason, this is the issue, you are in CC. Actually, using declarations are not
directly involved - I was misremembering - are only part of my ugly workaround,
and, beware, I menace to use it... ;)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (11 preceding siblings ...)
2009-07-14 14:00 ` paolo dot carlini at oracle dot com
@ 2009-07-14 18:16 ` jason at gcc dot gnu dot org
2009-07-14 18:44 ` jason at gcc dot gnu dot org
13 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-07-14 18:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jason at gcc dot gnu dot org 2009-07-14 18:16 -------
Subject: Bug 37276
Author: jason
Date: Tue Jul 14 18:16:03 2009
New Revision: 149638
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149638
Log:
PR c++/37276
* decl.c (decls_match): A non-extern-C declaration doesn't match
a builtin extern-C declaration.
Added:
trunk/gcc/testsuite/g++.dg/lookup/builtin5.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/other/error22.C
trunk/gcc/testsuite/g++.dg/warn/Warray-bounds.C
trunk/gcc/testsuite/gcc.dg/compat/compat-common.h
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
` (12 preceding siblings ...)
2009-07-14 18:16 ` jason at gcc dot gnu dot org
@ 2009-07-14 18:44 ` jason at gcc dot gnu dot org
13 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-07-14 18:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from jason at gcc dot gnu dot org 2009-07-14 18:44 -------
Fixed for 4.5.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/37276] Trouble with some (C99?) math builtins and namespace std
[not found] <bug-37276-4@http.gcc.gnu.org/bugzilla/>
@ 2012-11-15 1:54 ` jason at gcc dot gnu.org
0 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu.org @ 2012-11-15 1:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37276
--- Comment #14 from Jason Merrill <jason at gcc dot gnu.org> 2012-11-15 01:53:55 UTC ---
Author: jason
Date: Thu Nov 15 01:53:48 2012
New Revision: 193526
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193526
Log:
PR c++/37276
* decl.c (decls_match): Remove #ifdef around earlier fix.
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2012-11-15 1:54 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-29 12:54 [Bug c++/37276] New: Trouble with some (C99?) math builtins and namespace std paolo dot carlini at oracle dot com
2008-08-29 13:05 ` [Bug c++/37276] " paolo dot carlini at oracle dot com
2008-08-29 13:05 ` paolo dot carlini at oracle dot com
2008-08-29 13:09 ` rguenth at gcc dot gnu dot org
2008-08-29 13:13 ` rguenth at gcc dot gnu dot org
2008-08-29 14:19 ` paolo dot carlini at oracle dot com
2008-08-29 15:54 ` pinskia at gcc dot gnu dot org
2008-08-29 15:57 ` paolo dot carlini at oracle dot com
2008-08-29 16:03 ` paolo dot carlini at oracle dot com
2008-08-29 16:06 ` paolo dot carlini at oracle dot com
2008-08-29 18:47 ` paolo dot carlini at oracle dot com
2008-08-30 14:26 ` rguenther at suse dot de
2009-07-14 14:00 ` paolo dot carlini at oracle dot com
2009-07-14 18:16 ` jason at gcc dot gnu dot org
2009-07-14 18:44 ` jason at gcc dot gnu dot org
[not found] <bug-37276-4@http.gcc.gnu.org/bugzilla/>
2012-11-15 1:54 ` jason at gcc dot gnu.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).