http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56363

--- Comment #7 from Jay <jay.krell at cornell dot edu> 2013-02-20 08:51:49 UTC 
---
Here is the "successful experiment", where I changed the code to operate on all
the div variants. Of course I am NOT suggesting this change be made. Nor is it
100% conclusive. But it is very much indicative of a problem.


 mkdir /obj
/gcc.4
 cd /obj/gcc.4  

 /src/gcc-4.7.2/configure -prefix=$HOME/gcc.4 -enable-checking=fold
-enable-languages=c
make

...

/obj/gcc.4/./prev-gcc/g++ -B/obj/gcc.4/./prev-gcc/ ...
/src/gcc-4.7.2/gcc/fold-const.c -o fold-const.o
/src/gcc-4.7.2/gcc/fold-const.c: In function ‘tree_node*
fold_comparison(location_t, tree_code, tree, tree, tree)’:
/src/gcc-4.7.2/gcc/fold-const.c:8765:1: error: type mismatch in binary
expression
long long int

long long unsigned int

long long int

D.64567 = D.64566 /[ex] 8;

/src/gcc-4.7.2/gcc/fold-const.c:8765:1: error: type mismatch in binary
expression
long long int

long long unsigned int

long long int

D.64594 = D.64593 /[ex] 8;

/src/gcc-4.7.2/gcc/fold-const.c:8765: confused by earlier errors, bailing out
make[3]: *** [fold-const.o] Error 1
make[3]: Leaving directory `/Users/jay/obj/gcc.4/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/Users/jay/obj/gcc.4'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/Users/jay/obj/gcc.4'
make: *** [all] Error 2


jbook2:gcc-4.7.2 jay$ diff -ur /src/orig/gcc-4.7.2 /src/gcc-4.7.2
diff -ur /src/orig/gcc-4.7.2/gcc/fold-const.c /src/gcc-4.7.2/gcc/fold-const.c
--- /src/orig/gcc-4.7.2/gcc/fold-const.c    2012-06-01 10:03:19.000000000 -0700
+++ /src/gcc-4.7.2/gcc/fold-const.c    2013-02-19 08:19:31.000000000 -0800
@@ -12048,7 +12048,7 @@
      Note that only CEIL_DIV_EXPR and FLOOR_DIV_EXPR are rewritten now.
      At one time others generated faster code, it's not clear if they do
      after the last round to changes to the DIV code in expmed.c.  */
-      if ((code == CEIL_DIV_EXPR || code == FLOOR_DIV_EXPR)
+      if ((code == TRUNC_DIV_EXPR || code == ROUND_DIV_EXPR || code ==
FLOOR_DIV_EXPR || code == CEIL_DIV_EXPR)
       && multiple_of_p (type, arg0, arg1))
     return fold_build2_loc (loc, EXACT_DIV_EXPR, type, arg0, arg1);



Again, this is NOT a proposed patch. I am not that dumb. It helps SUGGEST that
there is a problem.


Perhaps I'll try with trunk.


 - Jay

Reply via email to