* [Bug tree-optimization/18089] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
@ 2004-10-20 20:01 ` drow at gcc dot gnu dot org
2004-10-20 20:18 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: drow at gcc dot gnu dot org @ 2004-10-20 20:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From drow at gcc dot gnu dot org 2004-10-20 20:01 -------
Created an attachment (id=7389)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7389&action=view)
Testcase.
valgrind --db-attach=yes gcc/stage2/cc1 -fpreprocessed ggc-common2.i -quiet -O1
-o ggc-common.s
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/18089] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
2004-10-20 20:01 ` [Bug tree-optimization/18089] " drow at gcc dot gnu dot org
@ 2004-10-20 20:18 ` pinskia at gcc dot gnu dot org
2004-12-19 15:08 ` steven at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-20 20:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-20 20:18 -------
REAL_VALUE_TYPE x = TREE_REAL_CST (arg1);
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/18089] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
2004-10-20 20:01 ` [Bug tree-optimization/18089] " drow at gcc dot gnu dot org
2004-10-20 20:18 ` pinskia at gcc dot gnu dot org
@ 2004-12-19 15:08 ` steven at gcc dot gnu dot org
2005-01-07 15:07 ` [Bug middle-end/18089] [4.0 regression] " reichelt at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-19 15:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-12-19 15:08 -------
Any news about this one?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18089] [4.0 regression] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-12-19 15:08 ` steven at gcc dot gnu dot org
@ 2005-01-07 15:07 ` reichelt at gcc dot gnu dot org
2005-01-08 21:06 ` reichelt at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-07 15:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-01-07 15:07 -------
I just stumbled over this one, too.
Even shorter testcase: valgrind --tool=memcheck cc1 -quiet vg.c
==================================
int foo() { return 1.0 + 1.1; }
==================================
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Component|tree-optimization |middle-end
Ever Confirmed| |1
Known to fail| |4.0.0
Known to work| |3.4.3
Last reconfirmed|0000-00-00 00:00:00 |2005-01-07 15:07:18
date| |
Summary|Valgrind errors in real.c |[4.0 regression] Valgrind
| |errors in real.c
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18089] [4.0 regression] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-01-07 15:07 ` [Bug middle-end/18089] [4.0 regression] " reichelt at gcc dot gnu dot org
@ 2005-01-08 21:06 ` reichelt at gcc dot gnu dot org
2005-01-10 9:33 ` reichelt at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-08 21:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-01-08 21:06 -------
Roger, the problem appears with your patch for PR17151:
http://gcc.gnu.org/ml/gcc-cvs/2004-09/msg01231.html
It looks like this causes a miscompilation of the stage2 compiler.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |sayle at gcc dot gnu dot org
Severity|normal |critical
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18089] [4.0 regression] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-01-08 21:06 ` reichelt at gcc dot gnu dot org
@ 2005-01-10 9:33 ` reichelt at gcc dot gnu dot org
2005-01-14 18:35 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-10 9:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-01-10 09:33 -------
Just another data point:
Reverting the patch on current mainline makes the problem disappear.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18089] [4.0 regression] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-01-10 9:33 ` reichelt at gcc dot gnu dot org
@ 2005-01-14 18:35 ` jakub at gcc dot gnu dot org
2005-01-14 20:20 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-14 18:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-01-14 18:35 -------
Are you sure this is not just a bug in valgrind?
I have verified that with current CVS I get
ERROR SUMMARY: 37 errors from 21 contexts (suppressed: 12 from 1)
while if I rebuild stage1's combine.o with Roger's patch backed out, link new
stage1 cc1, then rebuild stage2's real.o with the new stage1 cc1 and link new
stage2 cc1, I get
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 12 from 1)
I did a binary search on real.s and e.g. one of the valgrind errors is triggered
by following change in real.s:
@@ -6453,8 +6453,8 @@ round_for_format:
.p2align 2,,3
.L997:
movl (%ebp), %eax
+ subl $-2147483648, %eax
shrl $5, %eax
- xorl $67108864, %eax
subl $67108864, %eax
cmpl %eax, 32(%esp)
jge .L979
With the xorl there are no errors, with subl there is one error.
But I don't see any functional difference between these two.
If I replace 28 occurences of these subl $0x80000000, %eax before >> 5 to
xorl $0x4000000, %eax after >> 5 (I left out encoders/decoders of non-ieee
formats), valgrind stops reporting any errors.
So to me this looks like valgrind not handling subl $0x80000000, %eax
instruction correctly.
Do you agree?
I used valgrind 2.2.0.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18089] [4.0 regression] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-01-14 18:35 ` jakub at gcc dot gnu dot org
@ 2005-01-14 20:20 ` jakub at gcc dot gnu dot org
2005-01-14 20:36 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-14 20:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-01-14 20:20 -------
BTW, if I replace all
subl $-2147483648, %eax
instructions in real.s by:
xorl $-2147483648, %eax
(note that all such instructions are followed either by shrl, or addl, so
any differences in %eflags are ignored), it shuts valgrind up as well.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18089] [4.0 regression] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-01-14 20:20 ` jakub at gcc dot gnu dot org
@ 2005-01-14 20:36 ` jakub at gcc dot gnu dot org
2005-01-14 21:45 ` pinskia at gcc dot gnu dot org
2005-01-30 23:02 ` reichelt at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-14 20:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-01-14 20:36 -------
To prove this is a valgrind bug and not GCC bug, I wrote a small self-contained
testcase on which valgrind complains:
#define EXP_BITS (32 - 5)
struct real_value
{
unsigned int cl : 2;
unsigned int sign : 1;
unsigned int signalling : 1;
unsigned int canonical : 1;
unsigned int uexp : EXP_BITS;
unsigned long sig[4];
};
#if defined __i386__ && defined USE_ASM
#define REAL_EXP(REAL) \
({ int ret; \
__asm ("movl (%%eax),%%eax; subl $0x80000000,%%eax; shrl $5, %%eax; subl
$0x4000000,%%eax" \
: "=a" (ret) : "a" (REAL), "m" (*(REAL))); \
ret; })
#else
#define REAL_EXP(REAL) \
((int)((REAL)->uexp ^ (unsigned int)(1 << (EXP_BITS - 1))) \
- (1 << (EXP_BITS - 1)))
#endif
#if __GNUC__ >= 3
#define __noinline __attribute ((noinline))
#else
#define __noinline
#endif
int dummy;
void __noinline
bar (void)
{
++dummy;
}
void __noinline
foo (struct real_value *r)
{
if (REAL_EXP (r) <= 5)
bar ();
}
int
main (void)
{
struct real_value r;
r.uexp = 0x21;
foo (&r);
return 0;
}
Both with -DUSE_ASM and without CVS GCC generates the same assembly and in both
cases valgrind --tool=memcheck /tmp/test fails with:
==31022== Conditional jump or move depends on uninitialised value(s)
==31022== at 0x8048368: foo (test.c:41)
==31022== by 0x80483A4: main (test.c:50)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18089] [4.0 regression] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
` (8 preceding siblings ...)
2005-01-14 20:36 ` jakub at gcc dot gnu dot org
@ 2005-01-14 21:45 ` pinskia at gcc dot gnu dot org
2005-01-30 23:02 ` reichelt at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 21:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-14 21:45 -------
So closing as invalid, please report this to valgrind then.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|NEW |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18089] [4.0 regression] Valgrind errors in real.c
2004-10-20 20:00 [Bug tree-optimization/18089] New: Valgrind errors in real.c drow at gcc dot gnu dot org
` (9 preceding siblings ...)
2005-01-14 21:45 ` pinskia at gcc dot gnu dot org
@ 2005-01-30 23:02 ` reichelt at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-30 23:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-01-30 23:02 -------
Just for reference, this is now tracked in
http://bugs.kde.org/show_bug.cgi?id=97042
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18089
^ permalink raw reply [flat|nested] 12+ messages in thread