This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: serious inline math pb i386
- To: nbecker at fred dot net
- Subject: Re: serious inline math pb i386
- From: hjl at lucon dot org (H.J. Lu)
- Date: Wed, 8 Jul 1998 14:48:39 -0700 (PDT)
- Cc: aj at arthur dot rhein-neckar dot de, egcs-bugs at cygnus dot com, egcs-patches at cygnus dot com
>
> Yes! I have a test case!
>
> --------------------------
> #include <math.h>
>
> #define pc_ceiling_dB -4.9691
> #define pc_step_dB 0.5
> #define pc_loopdelay 1
>
> float pc_ceiling;
> float pc_step;
> float pc_threshold_dB = 17;
> float pc_threshold;
>
> main () {
> float pc_command[pc_loopdelay];
> int i_pc_loopdelay;
>
> for (i_pc_loopdelay = 0; i_pc_loopdelay < pc_loopdelay; i_pc_loopdelay++)
> pc_command[i_pc_loopdelay] = 0;
> pc_ceiling = pow (10.0, pc_ceiling_dB / 10.0);
> pc_step = pow (10.0, pc_step_dB / 10.0);
> pc_threshold = pow (10.0, pc_threshold_dB / 10.0);
> }
> ----------------------
>
> When I compile with egcs-1.0.3 glibc-2.0.7(RH5.1) i686-pc-linux-gnu:
>
> > g++ -o bug bug.cc -O3 -g
>
> (gdb) run
> Starting program: /home/nbecker/CDMA/bug
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x8048559 in main () at /usr/include/__math.h:297
> (gdb) where
> #0 0x8048559 in main () at /usr/include/__math.h:297
>
>
Please try this patch. BTW, the current egcs has the same problem.
But this testcase doesn't expose the bug in the current egcs.
The problem is for
(insn/i 49 45 50 (parallel[
(set (reg/v:DI 30)
(fix:DI (fix:DF (reg:DF 29))))
(clobber (reg:DF 29))
(clobber (mem:SI (plus:SI (reg:SI 31)
(const_int -4))))
(clobber (mem:DI (plus:SI (reg:SI 31)
(const_int -12))))
(clobber (scratch:SI))
] ) 119 {fix_truncsfdi2+2} (nil)
(expr_list:REG_EQUAL (fix:DI (const_double:DF (mem/u:DF (symbol_ref/u:SI ("*.LC1"))) 671088640 -53601192 -1073873302))
(nil)))
count_reg_usage fails to count (reg:SI 31) in
(clobber (mem:SI (plus:SI (reg:SI 31)
(const_int -4))))
(clobber (mem:DI (plus:SI (reg:SI 31)
(const_int -12))))
--
H.J. Lu (hjl@gnu.org)
----
Wed Jul 8 14:42:38 1998 H.J. Lu (hjl@gnu.org)
* cse.c (count_reg_usage): Count registers used by clobbered
memory.
--- ../../../import/egcs/gcc/cse.c Sun Nov 16 22:50:55 1997
+++ ./cse.c Wed Jul 8 14:27:33 1998
@@ -8576,7 +8576,11 @@ count_reg_usage (x, counts, dest, incr)
case CONST_DOUBLE:
case SYMBOL_REF:
case LABEL_REF:
+ return;
+
case CLOBBER:
+ if (GET_CODE (XEXP (x, 0)) == MEM)
+ count_reg_usage (XEXP (XEXP (x, 0), 0), counts, NULL_RTX, incr);
return;
case SET: