public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35456] New: Different results for inlined vs. non-inlined function
@ 2008-03-04 8:35 ubizjak at gmail dot com
2008-03-04 8:41 ` [Bug c/35456] " ubizjak at gmail dot com
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2008-03-04 8:35 UTC (permalink / raw)
To: gcc-bugs
The testcase:
--cut here--
#include <stdio.h>
double
__attribute__ ((noinline))
test (double x)
{
return x >= 0.0 ? x : -x;
}
double
__attribute__ ((always_inline))
test_inlined (double x)
{
return x >= 0.0 ? x : -x;
}
int main()
{
double x = -0.0;
printf ("%f %f %f\n", x, test(x), test_inlined(x));
return 0;
}
--cut here--
gcc -O2 abs.c
./a.out
-0.000000 0.000000 -0.000000
--
Summary: Different results for inlined vs. non-inlined function
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ubizjak at gmail dot com
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=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
@ 2008-03-04 8:41 ` ubizjak at gmail dot com
2008-03-04 8:49 ` Andrew Pinski
2008-03-04 8:49 ` pinskia at gmail dot com
` (6 subsequent siblings)
7 siblings, 1 reply; 10+ messages in thread
From: ubizjak at gmail dot com @ 2008-03-04 8:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from ubizjak at gmail dot com 2008-03-04 08:40 -------
Hm, -0.0 >= 0.0 is folded to TRUE, as confirmed by:
printf ("%i\n", -0.0 >= 0.0);
This produces 1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
2008-03-04 8:41 ` [Bug c/35456] " ubizjak at gmail dot com
@ 2008-03-04 8:49 ` pinskia at gmail dot com
2008-03-04 9:37 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gmail dot com @ 2008-03-04 8:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gmail dot com 2008-03-04 08:49 -------
Subject: Re: Different results for inlined vs. non-inlined function
Sent from my iPhone
On Mar 4, 2008, at 0:40, "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org
> wrote:
>
>
> ------- Comment #1 from ubizjak at gmail dot com 2008-03-04 08:40
> -------
> Hm, -0.0 >= 0.0 is folded to TRUE, as confirmed by:
>
> printf ("%i\n", -0.0 >= 0.0);
>
> This produces 1.
>
That is correct. The noinline case is wrong. It should not be
converted to be abs.
-- Pinski
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bug c/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:41 ` [Bug c/35456] " ubizjak at gmail dot com
@ 2008-03-04 8:49 ` Andrew Pinski
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Pinski @ 2008-03-04 8:49 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
Sent from my iPhone
On Mar 4, 2008, at 0:40, "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org
> wrote:
>
>
> ------- Comment #1 from ubizjak at gmail dot com 2008-03-04 08:40
> -------
> Hm, -0.0 >= 0.0 is folded to TRUE, as confirmed by:
>
> printf ("%i\n", -0.0 >= 0.0);
>
> This produces 1.
>
That is correct. The noinline case is wrong. It should not be
converted to be abs.
-- Pinski
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
2008-03-04 8:41 ` [Bug c/35456] " ubizjak at gmail dot com
2008-03-04 8:49 ` pinskia at gmail dot com
@ 2008-03-04 9:37 ` rguenth at gcc dot gnu dot org
2008-03-04 10:02 ` ubizjak at gmail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-04 9:37 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2008-03-04 09:36:51
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
` (2 preceding siblings ...)
2008-03-04 9:37 ` rguenth at gcc dot gnu dot org
@ 2008-03-04 10:02 ` ubizjak at gmail dot com
2008-03-04 12:41 ` [Bug middle-end/35456] " ubizjak at gmail dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2008-03-04 10:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from ubizjak at gmail dot com 2008-03-04 10:01 -------
Working on a fix.
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |ubizjak at gmail dot com
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2008-03-04 09:36:51 |2008-03-04 10:01:30
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
` (3 preceding siblings ...)
2008-03-04 10:02 ` ubizjak at gmail dot com
@ 2008-03-04 12:41 ` ubizjak at gmail dot com
2008-03-04 13:58 ` uros at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2008-03-04 12:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from ubizjak at gmail dot com 2008-03-04 12:41 -------
Patch at http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00207.html.
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2008-
| |03/msg00207.html
Component|c |middle-end
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
` (4 preceding siblings ...)
2008-03-04 12:41 ` [Bug middle-end/35456] " ubizjak at gmail dot com
@ 2008-03-04 13:58 ` uros at gcc dot gnu dot org
2008-03-10 14:15 ` uros at gcc dot gnu dot org
2008-03-10 14:17 ` ubizjak at gmail dot com
7 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu dot org @ 2008-03-04 13:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from uros at gcc dot gnu dot org 2008-03-04 13:58 -------
Subject: Bug 35456
Author: uros
Date: Tue Mar 4 13:57:27 2008
New Revision: 132863
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132863
Log:
PR middle-end/35456
* fold-const.c (fold_cond_expr_with_comparison): Prevent
transformations for modes that have signed zeros.
* ifcvt.c (noce_try_abs): Ditto.
testsuite/ChangeLog:
PR middle-end/35456
* gcc.c-torture/execute/pr35456.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr35456.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/ifcvt.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
` (5 preceding siblings ...)
2008-03-04 13:58 ` uros at gcc dot gnu dot org
@ 2008-03-10 14:15 ` uros at gcc dot gnu dot org
2008-03-10 14:17 ` ubizjak at gmail dot com
7 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu dot org @ 2008-03-10 14:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from uros at gcc dot gnu dot org 2008-03-10 14:14 -------
Subject: Bug 35456
Author: uros
Date: Mon Mar 10 14:13:40 2008
New Revision: 133079
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133079
Log:
Backport from mainline:
2008-03-09 Uros Bizjak <ubizjak@gmail.com>
PR target/35496
* config/i386/i386.c (ix86_constant_alignment): Compute alignment using
ALIGN_MODE_128 for VECTOR_CST and INTEGER_CST in addition to REAL_CST.
2008-03-04 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/35456
* fold-const.c (fold_cond_expr_with_comparison): Prevent
transformations for modes that have signed zeros.
* ifcvt.c (noce_try_abs): Ditto.
testsuite/ChangeLog:
Backport from mainline:
2008-03-04 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/35456
* gcc.c-torture/execute/pr35456.c: New test.
Added:
branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/pr35456.c
Modified:
branches/gcc-4_3-branch/gcc/ChangeLog
branches/gcc-4_3-branch/gcc/config/i386/i386.c
branches/gcc-4_3-branch/gcc/fold-const.c
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/35456] Different results for inlined vs. non-inlined function
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
` (6 preceding siblings ...)
2008-03-10 14:15 ` uros at gcc dot gnu dot org
@ 2008-03-10 14:17 ` ubizjak at gmail dot com
7 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2008-03-10 14:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from ubizjak at gmail dot com 2008-03-10 14:16 -------
Fixed.
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35456
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-03-10 14:17 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-04 8:35 [Bug c/35456] New: Different results for inlined vs. non-inlined function ubizjak at gmail dot com
2008-03-04 8:41 ` [Bug c/35456] " ubizjak at gmail dot com
2008-03-04 8:49 ` Andrew Pinski
2008-03-04 8:49 ` pinskia at gmail dot com
2008-03-04 9:37 ` rguenth at gcc dot gnu dot org
2008-03-04 10:02 ` ubizjak at gmail dot com
2008-03-04 12:41 ` [Bug middle-end/35456] " ubizjak at gmail dot com
2008-03-04 13:58 ` uros at gcc dot gnu dot org
2008-03-10 14:15 ` uros at gcc dot gnu dot org
2008-03-10 14:17 ` ubizjak at gmail dot com
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).