This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ast-optimizer-branch]: Your change to c-pretty-print.c is broken.
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: "Frank Ch. Eigler" <fche at redhat dot com>, <dnovillo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Sebastian Pop <s dot pop at laposte dot net>
- Date: Sun, 16 Jun 2002 23:32:03 -0400 (EDT)
- Subject: [ast-optimizer-branch]: Your change to c-pretty-print.c is broken.
On Wed, 12 Jun 2002, Frank Ch. Eigler wrote:
> Hi -
>
> I'm planning to commit the following patch. It fixes the printing of
> expressions like
>
> char *p;
> int *q;
> p[8] = 'a';
> p[7] = 5;
>
> where the 8/7 indices were not both correctly printed because the
> size of the pointed-to type was accounted for improperly.
>
> - FChE
However, it broke some printing completly.
(gdb) r
Starting program: /buildspace/ast-optimizer-clean/gcc/cc1 -fdump-tree-simple-unparse /home/dberlin/lrs3.2a.i -O2
Breakpoint 2 at 0x4004ef06
Breakpoint 3 at 0x4004dd55
main estimate reverse selectpivot pivot primalfeasible {GC 5342k ->
595k} solvelp getabasis restartpivots ratio {GC 5408k -> 826k} lexmin
ismin myrandom updatevolume printsol update reorder atos stringcpy readA
{GC 7391k -> 1444k} readfacets readrat atomp readmp itomp atoaa printA
prat prtotals pimat pmp gcd {GC 5500k -> 1168k} reduce lcm greater copy
linint normalize mulint comprod divint notimpl cache_dict pushQ
Program received signal SIGFPE, Arithmetic exception.
0x080c5737 in dump_c_node (buffer=0xbfffec00, node=0x405f1e00, spc=10) at c-pretty-print.c:360
360 (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node)))));
(gdb) l
355 case INTEGER_CST:
356 if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE)
357 /* In the case of a pointer, divide by the size of the pointed-to type. */
358 output_decimal (buffer,
359 TREE_INT_CST_LOW (node) * BITS_PER_UNIT /
360 (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node)))));
361 else
362 output_decimal (buffer, TREE_INT_CST_LOW (node));
363 break;
364
(gdb) p debug_tree (node)
<integer_cst 0x405f1e00 type <pointer_type 0x4022d9f8> constant 0>
TREE_INT_CST_LOW (node) = 0
TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) == 0
(0 * <something>) / 0 = boom.
This is pre-simplification, the node above is in a if (p) where p ==
pointer to a structure.
--Dan