* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
@ 2005-08-18 20:44 ` ddneilson at gmail dot com
2005-08-18 20:45 ` ddneilson at gmail dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-18 20:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ddneilson at gmail dot com 2005-08-18 20:43 -------
Created an attachment (id=9535)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9535&action=view)
Source file of example
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
2005-08-18 20:44 ` [Bug other/23469] " ddneilson at gmail dot com
@ 2005-08-18 20:45 ` ddneilson at gmail dot com
2005-08-18 20:46 ` ddneilson at gmail dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-18 20:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ddneilson at gmail dot com 2005-08-18 20:44 -------
Created an attachment (id=9536)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9536&action=view)
.ii file generated by compiling with: g++ -Wall -v -save-temps signbit.cpp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
2005-08-18 20:44 ` [Bug other/23469] " ddneilson at gmail dot com
2005-08-18 20:45 ` ddneilson at gmail dot com
@ 2005-08-18 20:46 ` ddneilson at gmail dot com
2005-08-18 20:47 ` ddneilson at gmail dot com
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-18 20:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ddneilson at gmail dot com 2005-08-18 20:45 -------
Created an attachment (id=9537)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9537&action=view)
Ouput from compile with: g++ -Wall -v -save-temps signbit.cpp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
` (2 preceding siblings ...)
2005-08-18 20:46 ` ddneilson at gmail dot com
@ 2005-08-18 20:47 ` ddneilson at gmail dot com
2005-08-18 20:47 ` ddneilson at gmail dot com
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-18 20:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ddneilson at gmail dot com 2005-08-18 20:46 -------
Created an attachment (id=9538)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9538&action=view)
.ii file generated by compiling with: g++ -Wall -v -O1 -save-temps signbit.cpp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
` (3 preceding siblings ...)
2005-08-18 20:47 ` ddneilson at gmail dot com
@ 2005-08-18 20:47 ` ddneilson at gmail dot com
2005-08-18 20:49 ` ddneilson at gmail dot com
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-18 20:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ddneilson at gmail dot com 2005-08-18 20:47 -------
Created an attachment (id=9539)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9539&action=view)
Output from compile with: g++ -Wall -v -O1 -save-temps signbit.cpp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
` (4 preceding siblings ...)
2005-08-18 20:47 ` ddneilson at gmail dot com
@ 2005-08-18 20:49 ` ddneilson at gmail dot com
2005-08-18 20:49 ` ddneilson at gmail dot com
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-18 20:49 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Attachment #9537|Ouput from compile with: g++|Output from compile with:
description|-Wall -v -save-temps |g++ -Wall -v -save-temps
|signbit.cpp |signbit.cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
` (5 preceding siblings ...)
2005-08-18 20:49 ` ddneilson at gmail dot com
@ 2005-08-18 20:49 ` ddneilson at gmail dot com
2005-08-18 21:15 ` ddneilson at gmail dot com
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-18 20:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ddneilson at gmail dot com 2005-08-18 20:49 -------
Created an attachment (id=9540)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9540&action=view)
Output from running the program without optimizations
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
` (6 preceding siblings ...)
2005-08-18 20:49 ` ddneilson at gmail dot com
@ 2005-08-18 21:15 ` ddneilson at gmail dot com
2005-08-18 22:14 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-18 21:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ddneilson at gmail dot com 2005-08-18 20:49 -------
Created an attachment (id=9541)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9541&action=view)
Output from running the program with -O1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
` (7 preceding siblings ...)
2005-08-18 21:15 ` ddneilson at gmail dot com
@ 2005-08-18 22:14 ` pinskia at gcc dot gnu dot org
2005-08-21 20:28 ` ddneilson at gmail dot com
2005-08-21 20:34 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-18 22:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-18 21:41 -------
This is not a bug as signbit just have to return a non zero value if it has the value passed has its sign
bit set.
So defining it this way:
inline int mysignbit(float x) {
union { float f; unsigned int i; } u;
u.f = x;
return u.i&0x80000000UL;
}
Is also legal.
The reason for the different is optimizing for size vs optimizing for speed. The definition you gave is
faster but larger.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
` (8 preceding siblings ...)
2005-08-18 22:14 ` pinskia at gcc dot gnu dot org
@ 2005-08-21 20:28 ` ddneilson at gmail dot com
2005-08-21 20:34 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: ddneilson at gmail dot com @ 2005-08-21 20:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ddneilson at gmail dot com 2005-08-21 20:28 -------
One of the really odd things, that makes me still think this is a bug in some
way is that the definition of "mysignbit()" that I gave in signbit.cpp is
identical to the definition of __signbitf(x) as given in bits/mathinline.h. But,
yet, when optimizations aren't turned on the two functions have differing return
values; mysignbit() will return 1 iff the signbit is set, whereas __signbitf()
will return 0x80000000 iff the signbit is set.
Furthermore, when all documented -O1 flags are turned on manually (without
actually using -O1) the output of __signbitf(x) is the same as the unoptimized
version; it only differs when one of the -On flags are used.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
2005-08-18 20:43 [Bug other/23469] New: Behaviour of built-in __signbitf(x) differs with optimization ddneilson at gmail dot com
` (9 preceding siblings ...)
2005-08-21 20:28 ` ddneilson at gmail dot com
@ 2005-08-21 20:34 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-21 20:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-21 20:31 -------
Again this is not a bug as signbitf says about nonzero value and nothing about the exact value. In fact
it changes based on optimizations is because well some times it is for size reasons, look at -Os and
you will see that.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469
^ permalink raw reply [flat|nested] 12+ messages in thread