]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/fold-const.c
re PR c/39855 (Shift optimization discards operands' side effects)
[gcc.git] / gcc / fold-const.c
index ca07cf16720427edfad48c1e39044ede0fccbdc9..f0ff5b69fc182c32823f95f4000d9cbe5bfd2de6 100644 (file)
@@ -11880,7 +11880,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
              if (code == LROTATE_EXPR || code == RROTATE_EXPR)
                low = low % TYPE_PRECISION (type);
              else if (TYPE_UNSIGNED (type) || code == LSHIFT_EXPR)
-               return build_int_cst (type, 0);
+               return omit_one_operand (type, build_int_cst (type, 0),
+                                        TREE_OPERAND (arg0, 0));
              else
                low = TYPE_PRECISION (type) - 1;
            }
This page took 0.038076 seconds and 5 git commands to generate.