https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90806

--- Comment #12 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> So you say that a not bootstrapped GCC 10 compiler compiled with
> a recent host GCC 11 compiler folds to 1 while using a host GCC 10 (or 9)
> compiler does not fold to 1?

Sorry, I mixed things a little bit.  Here's a recipe: bootstrap the current 9
branch with the current 10 branch as base compiler and STAGE1_CFLAGS="-O -g".
Then, for the above reduced testcase, the FRE1 pass does not behave the same at
-O2 for the stage #1 and #2 (or #3) compilers:

--- t.c.033t.fre1.1     2021-01-05 10:32:31.381344944 +0100
+++ t.c.033t.fre1       2021-01-05 10:33:17.053197054 +0100
@@ -12,12 +12,16 @@
 {
   char * p;
   char ar3[3];
+  char _2;
+  int _3;
   char _5;
   int _6;

   <bb 2> :
   ar3 = "\x01\x02\x03";
-  sink (0, 1);
+  _2 = MEM[(char *)&ar3 + -9223372036854775808B];
+  _3 = (int) _2;
+  sink (0, _3);
   _5 = MEM[(char *)&ar3 + -1B];
   _6 = (int) _5;
   sink (0, _6);

I'm trying to find out whether I can reproduce with more recent compilers.

Reply via email to