On Fri, Jan 12, 2018 at 10:25:30AM +0100, Richard Biener wrote:
> On Fri, 12 Jan 2018, Jakub Jelinek wrote:
> 
> > On Fri, Jan 12, 2018 at 09:16:35AM +0100, Richard Biener wrote:
> > > Or another workaround would be to make sure non-constant sizepos
> > > stay non-constant by doing sth like the following?  FEs can mark
> > > expressions as TREE_CONSTANT if they don't want this behavior
> > > for things that might optimize to constants during gimplification.
> > 
> > Not against that, though in that case perhaps it can be even just
> > +  if (is_gimple_constant (*expr_p))
> > +    *expr_p = get_initialized_tmp_var (*expr_p, stmt_p, NULL, false);
> > with a comment, because the function has an early exit for:
> >   if (is_gimple_sizepos (expr))
> >     return;
> 
> But say (static const foo = 1) + 2 aka foo + 2 marked with TREE_CONSTANT
> isn't is_gimple_sizepos.  But maybe we require FEs to fold TREE_CONSTANT
> expressions prior to gimplification and not rely on the gimplifier here?
> 
> > Would you be ok with that?  In that case I'd probably do a bootstrap/regtest
> > with statistics gathering on when this happens, dunno about Ada and other
> > FEs how often they do this kind of thing.
> 
> That would certainly be interesting (also whether they'd be
> TREE_CONSTANT).
> 
> is_gimple_sizepos is also somehwat suspicious as it would allow
> a global VAR_DECL as valid, not just sth that is is_gimple_reg.

So, I've bootstrapped/regtested the patch at the end of this mail together
with incremental hack:
--- gcc/gimplify.c.jj   2018-01-12 14:06:14.050276747 +0100
+++ gcc/gimplify.c      2018-01-12 14:08:27.131280662 +0100
@@ -12567,6 +12567,12 @@ gimplify_one_sizepos (tree *expr_p, gimp
 
   *expr_p = unshare_expr (expr);
 
+if (TREE_CONSTANT (*expr_p))
+{
+FILE *f = fopen ("/tmp/sizepos", "a");
+fprintf (f, "%d %s %s TREE_CONSTANT\n", (int) BITS_PER_WORD, 
main_input_filename ? main_input_filename : "-", current_function_name ());
+fclose (f);
+}
   /* SSA names in decl/type fields are a bad idea - they'll get reclaimed
      if the def vanishes.  */
   gimplify_expr (expr_p, stmt_p, NULL, is_gimple_val, fb_rvalue, false);
@@ -12575,7 +12581,12 @@ gimplify_one_sizepos (tree *expr_p, gimp
      is a VAR_DECL, otherwise we might handle some decls as gimplify_vla_decl
      even when they would have all sizes INTEGER_CSTs.  */
   if (is_gimple_constant (*expr_p))
+{
     *expr_p = get_initialized_tmp_var (*expr_p, stmt_p, NULL, false);
+FILE *f = fopen ("/tmp/sizepos", "a");
+fprintf (f, "%d %s %s is_gimple_constant\n", (int) BITS_PER_WORD, 
main_input_filename ? main_input_filename : "-", current_function_name ());
+fclose (f);
+}
 }
 
 /* Gimplify the body of statements of FNDECL and return a GIMPLE_BIND node

In a few C testcases the cases with TREE_CONSTANT before gimplify_expr are
stuff like:
extern void dynreplace_trampoline(void);
extern void dynreplace_trampoline_endlabel(void);
int dynreplace_add_trampoline(void)
{
  unsigned long trampoline_code[(((unsigned long) 
(&(dynreplace_trampoline_endlabel))-(unsigned long) (&dynreplace_trampoline)))];
}
and similar, for C is_gimple_constant after, i.e. what the patch changes, is
those VLAs that use const vars in the expressions.  Changing that is perhaps
acceptable.  On the other side, the amount of Ada changes is significantly
higher.  Perhaps do
  if (is_gimple_constant (*expr_p)
      && (flag_openmp || flag_openacc || flag_openmp_simd))
, that way it will never affect Ada.

Results of this below.
grep 'is_gimple_constant$' /tmp/sizepos | wc -l
4050
grep 'CONSTANT$' /tmp/sizepos | wc -l
3264
sort /tmp/sizepos  | uniq -c | sort -nr
    106 64 cxg2009.adb cxg2009 TREE_CONSTANT
    106 64 cxg2009.adb cxg2009 is_gimple_constant
     96 64 /home/jakub/src/gcc/gcc/testsuite/c-c++-common/ubsan/bounds-1.c main 
is_gimple_constant
     96 32 /home/jakub/src/gcc/gcc/testsuite/c-c++-common/ubsan/bounds-1.c main 
is_gimple_constant
     74 64 cxg2021.adb cxg2021 TREE_CONSTANT
     74 64 cxg2021.adb cxg2021 is_gimple_constant
     74 64 cxg2020.adb cxg2020 TREE_CONSTANT
     74 64 cxg2020.adb cxg2020 is_gimple_constant
     74 64 cxg2019.adb cxg2019 TREE_CONSTANT
     74 64 cxg2019.adb cxg2019 is_gimple_constant
     74 64 cxg2018.adb cxg2018 TREE_CONSTANT
     74 64 cxg2018.adb cxg2018 is_gimple_constant
     60 64 a74106b.adb a74106b TREE_CONSTANT
     60 64 a74106b.adb a74106b is_gimple_constant
     48 64 /home/jakub/src/gcc/gcc/testsuite/gcc.c-torture/compile/20000923-1.c 
foo is_gimple_constant
     48 32 /home/jakub/src/gcc/gcc/testsuite/gcc.c-torture/compile/20000923-1.c 
foo is_gimple_constant
     46 64 cxg2008.adb cxg2008 TREE_CONSTANT
     46 64 cxg2008.adb cxg2008 is_gimple_constant
     46 64 cxg2002.adb cxg2002 TREE_CONSTANT
     46 64 cxg2002.adb cxg2002 is_gimple_constant
     42 64 /home/jakub/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-2.c main 
is_gimple_constant
     42 64 cxg2010.adb cxg2010 TREE_CONSTANT
     42 64 cxg2010.adb cxg2010 is_gimple_constant
     42 64 cxg2007.adb cxg2007 TREE_CONSTANT
     42 64 cxg2007.adb cxg2007 is_gimple_constant
     42 64 cxg2006.adb cxg2006 TREE_CONSTANT
     42 64 cxg2006.adb cxg2006 is_gimple_constant
     42 64 cxg2003.adb cxg2003 TREE_CONSTANT
     42 64 cxg2003.adb cxg2003 is_gimple_constant
     42 32 /home/jakub/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-2.c main 
is_gimple_constant
     38 64 cxg2017.adb cxg2017 TREE_CONSTANT
     38 64 cxg2017.adb cxg2017 is_gimple_constant
     38 64 cxg2016.adb cxg2016 TREE_CONSTANT
     38 64 cxg2016.adb cxg2016 is_gimple_constant
     38 64 cxg2015.adb cxg2015 TREE_CONSTANT
     38 64 cxg2015.adb cxg2015 is_gimple_constant
     38 64 cxg2014.adb cxg2014 TREE_CONSTANT
     38 64 cxg2014.adb cxg2014 is_gimple_constant
     38 64 cxg2013.adb cxg2013 TREE_CONSTANT
     38 64 cxg2013.adb cxg2013 is_gimple_constant
     38 64 cxg2012.adb cxg2012 TREE_CONSTANT
     38 64 cxg2012.adb cxg2012 is_gimple_constant
     38 64 cxg2011.adb cxg2011 TREE_CONSTANT
     38 64 cxg2011.adb cxg2011 is_gimple_constant
     38 64 cxg2004.adb cxg2004 TREE_CONSTANT
     38 64 cxg2004.adb cxg2004 is_gimple_constant
     38 64 cxg2001.adb cxg2001 TREE_CONSTANT
     38 64 cxg2001.adb cxg2001 is_gimple_constant
     38 64 cc1222a.adb cc1222a TREE_CONSTANT
     38 64 cc1222a.adb cc1222a is_gimple_constant
     36 64 cxg1005.adb cxg1005 TREE_CONSTANT
     36 64 cxg1005.adb cxg1005 is_gimple_constant
     36 64 cxg1004.adb cxg1004 TREE_CONSTANT
     36 64 cxg1004.adb cxg1004 is_gimple_constant
     36 64 c43004a.adb c43004a TREE_CONSTANT
     36 64 c43004a.adb c43004a is_gimple_constant
     35 64 
/home/jakub/src/gcc/gcc/testsuite/gcc.c-torture/compile/vla-const-1.c f 
TREE_CONSTANT
     35 64 
/home/jakub/src/gcc/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c 
dynreplace_add_trampoline TREE_CONSTANT
     35 64 /home/jakub/src/gcc/gcc/testsuite/c-c++-common/ubsan/pr71512-1.c 
DrawChunk is_gimple_constant
     35 64 
/home/jakub/src/gcc/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c Run 
is_gimple_constant
     35 64 /home/jakub/src/gcc/gcc/testsuite/c-c++-common/asan/clone-test-1.c 
main is_gimple_constant
     35 32 
/home/jakub/src/gcc/gcc/testsuite/gcc.c-torture/compile/vla-const-1.c f 
TREE_CONSTANT
     35 32 
/home/jakub/src/gcc/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c 
dynreplace_add_trampoline TREE_CONSTANT
     35 32 /home/jakub/src/gcc/gcc/testsuite/c-c++-common/ubsan/pr71512-1.c 
DrawChunk is_gimple_constant
     35 32 
/home/jakub/src/gcc/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c Run 
is_gimple_constant
     35 32 /home/jakub/src/gcc/gcc/testsuite/c-c++-common/asan/clone-test-1.c 
main is_gimple_constant
     34 64 cc3232a.adb cc3232a TREE_CONSTANT
     34 64 cc3232a.adb cc3232a is_gimple_constant
     30 64 cxaa009.adb cxaa009 TREE_CONSTANT
     30 64 cxaa009.adb cxaa009 is_gimple_constant
     28 64 cc3601a.adb cc3601a TREE_CONSTANT
     28 64 cc3601a.adb cc3601a is_gimple_constant
     28 64 c52005e.adb c52005e TREE_CONSTANT
     28 64 c52005e.adb c52005e is_gimple_constant
     28 64 c52005b.adb c52005b TREE_CONSTANT
     28 64 c52005b.adb c52005b is_gimple_constant
     24 64 cxg1003.adb cxg1003 TREE_CONSTANT
     24 64 cxg1003.adb cxg1003 is_gimple_constant
     24 64 c64103b.adb c64103b TREE_CONSTANT
     24 64 c64103b.adb c64103b is_gimple_constant
     24 64 c49025a.adb c49025a TREE_CONSTANT
     24 64 c49025a.adb c49025a is_gimple_constant
     24 64 c47005a.adb c47005a TREE_CONSTANT
     24 64 c47005a.adb c47005a is_gimple_constant
     24 64 c45242b.adb c45242b TREE_CONSTANT
     24 64 c45242b.adb c45242b is_gimple_constant
     24 64 c35801d.adb c35801d TREE_CONSTANT
     24 64 c35801d.adb c35801d is_gimple_constant
     24 64 c35704c.adb c35704c TREE_CONSTANT
     24 64 c35704c.adb c35704c is_gimple_constant
     24 64 c35704b.adb c35704b TREE_CONSTANT
     24 64 c35704b.adb c35704b is_gimple_constant
     24 64 a35801f.adb a35801f TREE_CONSTANT
     24 64 a35801f.adb a35801f is_gimple_constant
     22 64 cc3125c.adb cc3125c TREE_CONSTANT
     22 64 cc3125c.adb cc3125c is_gimple_constant
     22 64 cc1111a.adb cc1111a TREE_CONSTANT
     22 64 cc1111a.adb cc1111a is_gimple_constant
     20 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/c99-const-expr-12.c f 
is_gimple_constant
     20 64 cxg1002.adb cxg1002 TREE_CONSTANT
     20 64 cxg1002.adb cxg1002 is_gimple_constant
     20 64 cxg1001.adb cxg1001 TREE_CONSTANT
     20 64 cxg1001.adb cxg1001 is_gimple_constant
     20 64 cxa5a10.adb cxa5a10 TREE_CONSTANT
     20 64 cxa5a10.adb cxa5a10 is_gimple_constant
     20 64 cxa5a09.adb cxa5a09 TREE_CONSTANT
     20 64 cxa5a09.adb cxa5a09 is_gimple_constant
     20 64 cxa5a08.adb cxa5a08 TREE_CONSTANT
     20 64 cxa5a08.adb cxa5a08 is_gimple_constant
     20 64 cxa5a07.adb cxa5a07 TREE_CONSTANT
     20 64 cxa5a07.adb cxa5a07 is_gimple_constant
     20 64 cxa5a06.adb cxa5a06 TREE_CONSTANT
     20 64 cxa5a06.adb cxa5a06 is_gimple_constant
     20 64 cxa5a05.adb cxa5a05 TREE_CONSTANT
     20 64 cxa5a05.adb cxa5a05 is_gimple_constant
     20 64 cxa5a04.adb cxa5a04 TREE_CONSTANT
     20 64 cxa5a04.adb cxa5a04 is_gimple_constant
     20 64 cxa5a03.adb cxa5a03 TREE_CONSTANT
     20 64 cxa5a03.adb cxa5a03 is_gimple_constant
     20 64 cxa5a02.adb cxa5a02 TREE_CONSTANT
     20 64 cxa5a02.adb cxa5a02 is_gimple_constant
     20 64 cxa5a01.adb cxa5a01 TREE_CONSTANT
     20 64 cxa5a01.adb cxa5a01 is_gimple_constant
     20 64 cc3222a.adb cc3222a TREE_CONSTANT
     20 64 cc3222a.adb cc3222a is_gimple_constant
     20 64 c34003c.adb c34003c TREE_CONSTANT
     20 64 c34003c.adb c34003c is_gimple_constant
     20 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/c99-const-expr-12.c f 
is_gimple_constant
     18 64 cc3016b.adb cc3016b TREE_CONSTANT
     18 64 cc3016b.adb cc3016b is_gimple_constant
     18 64 c87b23a.adb c87b23a TREE_CONSTANT
     18 64 c87b23a.adb c87b23a is_gimple_constant
     18 64 c49026a.adb c49026a TREE_CONSTANT
     18 64 c49026a.adb c49026a is_gimple_constant
     18 64 c32001a.adb c32001a TREE_CONSTANT
     18 64 c32001a.adb c32001a is_gimple_constant
     17 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/enum-incomplete-3.c foo 
is_gimple_constant
     17 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/enum-incomplete-3.c foo 
is_gimple_constant
     16 64 s-rannum.adb system.random_numbers.random TREE_CONSTANT
     16 64 s-rannum.adb system.random_numbers.random is_gimple_constant
     16 64 s-rannum.adb system.random_numbers.random.f TREE_CONSTANT
     16 64 s-rannum.adb system.random_numbers.random.f is_gimple_constant
     16 64 g-forstr.adb gnat.formatted_string."&" TREE_CONSTANT
     16 64 g-forstr.adb gnat.formatted_string."&" is_gimple_constant
     16 64 g-forstr.adb gnat.formatted_string."&".float_format TREE_CONSTANT
     16 64 g-forstr.adb gnat.formatted_string."&".float_format 
is_gimple_constant
     16 64 cxa5015.adb cxa5015 TREE_CONSTANT
     16 64 cxa5015.adb cxa5015 is_gimple_constant
     16 64 c49023a.adb c49023a TREE_CONSTANT
     16 64 c49023a.adb c49023a is_gimple_constant
     16 64 c38102b.adb c38102b TREE_CONSTANT
     16 64 c38102b.adb c38102b is_gimple_constant
     16 64 c35704d.adb c35704d TREE_CONSTANT
     16 64 c35704d.adb c35704d is_gimple_constant
     16 32 s-rannum.adb system.random_numbers.random TREE_CONSTANT
     16 32 s-rannum.adb system.random_numbers.random is_gimple_constant
     16 32 s-rannum.adb system.random_numbers.random.f TREE_CONSTANT
     16 32 s-rannum.adb system.random_numbers.random.f is_gimple_constant
     16 32 g-forstr.adb gnat.formatted_string."&" TREE_CONSTANT
     16 32 g-forstr.adb gnat.formatted_string."&" is_gimple_constant
     16 32 g-forstr.adb gnat.formatted_string."&".float_format TREE_CONSTANT
     16 32 g-forstr.adb gnat.formatted_string."&".float_format 
is_gimple_constant
     14 64 la140052.adb la140052 TREE_CONSTANT
     14 64 la140052.adb la140052 is_gimple_constant
     14 64 cxg2005.adb cxg2005 TREE_CONSTANT
     14 64 cxg2005.adb cxg2005 is_gimple_constant
     14 64 ce3806c.adb ce3806c TREE_CONSTANT
     14 64 ce3806c.adb ce3806c is_gimple_constant
     14 64 ce3804f.adb ce3804f TREE_CONSTANT
     14 64 ce3804f.adb ce3804f is_gimple_constant
     14 64 cd2c11a.adb cd2c11a TREE_CONSTANT
     14 64 cd2c11a.adb cd2c11a is_gimple_constant
     14 64 cd10002.adb cd10002 TREE_CONSTANT
     14 64 cd10002.adb cd10002 is_gimple_constant
     14 64 c85018b.adb c85018b TREE_CONSTANT
     14 64 c85018b.adb c85018b is_gimple_constant
     14 64 c74302b.adb c74302b TREE_CONSTANT
     14 64 c74302b.adb c74302b is_gimple_constant
     14 64 c3a0010.adb c3a0010 TREE_CONSTANT
     14 64 c3a0010.adb c3a0010 is_gimple_constant
     14 64 c3a0003.adb c3a0003 TREE_CONSTANT
     14 64 c3a0003.adb c3a0003 is_gimple_constant
     14 64 c32111b.adb c32111b TREE_CONSTANT
     14 64 c32111b.adb c32111b is_gimple_constant
     14 64 c32111a.adb c32111a TREE_CONSTANT
     14 64 c32111a.adb c32111a is_gimple_constant
     12 64 cc51006.adb cc51006 TREE_CONSTANT
     12 64 cc51006.adb cc51006 is_gimple_constant
     12 64 c87b34b.adb c87b34b TREE_CONSTANT
     12 64 c87b34b.adb c87b34b is_gimple_constant
     12 64 c87b10a.adb c87b10a TREE_CONSTANT
     12 64 c87b10a.adb c87b10a is_gimple_constant
     12 64 c87b09c.adb c87b09c TREE_CONSTANT
     12 64 c87b09c.adb c87b09c is_gimple_constant
     12 64 c87b09a.adb c87b09a TREE_CONSTANT
     12 64 c87b09a.adb c87b09a is_gimple_constant
     12 64 c83051a.adb c83051a TREE_CONSTANT
     12 64 c83051a.adb c83051a is_gimple_constant
     12 64 c47002b.adb c47002b TREE_CONSTANT
     12 64 c47002b.adb c47002b is_gimple_constant
     12 64 c46021a.adb c46021a TREE_CONSTANT
     12 64 c46021a.adb c46021a is_gimple_constant
     12 64 c460008.adb c460008 TREE_CONSTANT
     12 64 c460008.adb c460008 is_gimple_constant
     12 64 c3a0015.adb c3a0015 TREE_CONSTANT
     12 64 c3a0015.adb c3a0015 is_gimple_constant
     12 64 c38102e.adb c38102e.proc TREE_CONSTANT
     12 64 c38102e.adb c38102e.proc is_gimple_constant
     12 64 c35703a.adb c35703a TREE_CONSTANT
     12 64 c35703a.adb c35703a is_gimple_constant
     12 64 c34003a.adb c34003a TREE_CONSTANT
     12 64 c34003a.adb c34003a is_gimple_constant
     10 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/combined-directives-1.c
 main is_gimple_constant
     10 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr25682.c foo 
is_gimple_constant
     10 64 ce3810a.adb ce3810a TREE_CONSTANT
     10 64 ce3810a.adb ce3810a is_gimple_constant
     10 64 ce3809a.adb ce3809a TREE_CONSTANT
     10 64 ce3809a.adb ce3809a is_gimple_constant
     10 64 ce3806e.adb ce3806e TREE_CONSTANT
     10 64 ce3806e.adb ce3806e is_gimple_constant
     10 64 ce3806d.adb ce3806d TREE_CONSTANT
     10 64 ce3806d.adb ce3806d is_gimple_constant
     10 64 ce3804i.adb ce3804i TREE_CONSTANT
     10 64 ce3804i.adb ce3804i is_gimple_constant
     10 64 ce3804g.adb ce3804g TREE_CONSTANT
     10 64 ce3804g.adb ce3804g is_gimple_constant
     10 64 ce3804d.adb ce3804d TREE_CONSTANT
     10 64 ce3804d.adb ce3804d is_gimple_constant
     10 64 ce3804a.adb ce3804a TREE_CONSTANT
     10 64 ce3804a.adb ce3804a is_gimple_constant
     10 64 ce3801a.adb ce3801a TREE_CONSTANT
     10 64 ce3801a.adb ce3801a is_gimple_constant
     10 64 c87b41a.adb c87b41a TREE_CONSTANT
     10 64 c87b41a.adb c87b41a is_gimple_constant
     10 64 c87b08a.adb c87b08a TREE_CONSTANT
     10 64 c87b08a.adb c87b08a is_gimple_constant
     10 64 c45252b.adb c45252b TREE_CONSTANT
     10 64 c45252b.adb c45252b is_gimple_constant
     10 64 c392002.adb c392002 TREE_CONSTANT
     10 64 c392002.adb c392002 is_gimple_constant
     10 64 c38102e.adb c38102e TREE_CONSTANT
     10 64 c38102e.adb c38102e is_gimple_constant
     10 64 c35003d.adb c35003d TREE_CONSTANT
     10 64 c35003d.adb c35003d is_gimple_constant
     10 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/combined-directives-1.c
 main is_gimple_constant
     10 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr25682.c foo 
is_gimple_constant
      9 64 c87b04b.adb c87b04b TREE_CONSTANT
      9 64 c87b04b.adb c87b04b is_gimple_constant
      9 64 c34011b.adb c34011b TREE_CONSTANT
      9 64 c34011b.adb c34011b is_gimple_constant
      8 64 s-fatsfl.ads system.fat_sflt.attr_short_float.valid TREE_CONSTANT
      8 64 s-fatsfl.ads system.fat_sflt.attr_short_float.valid 
is_gimple_constant
      8 64 s-fatllf.ads system.fat_llf.attr_long_long_float.valid TREE_CONSTANT
      8 64 s-fatllf.ads system.fat_llf.attr_long_long_float.valid 
is_gimple_constant
      8 64 s-fatlfl.ads system.fat_lflt.attr_long_float.valid TREE_CONSTANT
      8 64 s-fatlfl.ads system.fat_lflt.attr_long_float.valid is_gimple_constant
      8 64 s-fatflt.ads system.fat_flt.attr_float.valid TREE_CONSTANT
      8 64 s-fatflt.ads system.fat_flt.attr_float.valid is_gimple_constant
      8 64 
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-user-1.c main 
is_gimple_constant
      8 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/gomp/pr47963.c foo 
is_gimple_constant
      8 64 cda201b.adb cda201b TREE_CONSTANT
      8 64 cda201b.adb cda201b is_gimple_constant
      8 64 cc3305c.adb cc3305c TREE_CONSTANT
      8 64 cc3305c.adb cc3305c is_gimple_constant
      8 64 cc1311b.adb cc1311b TREE_CONSTANT
      8 64 cc1311b.adb cc1311b is_gimple_constant
      8 64 c87b30a.adb c87b30a TREE_CONSTANT
      8 64 c87b30a.adb c87b30a is_gimple_constant
      8 64 c87b18b.adb c87b18b TREE_CONSTANT
      8 64 c87b18b.adb c87b18b is_gimple_constant
      8 64 c3a0015.adb c3a0015.std.check3 TREE_CONSTANT
      8 64 c3a0015.adb c3a0015.std.check3 is_gimple_constant
      8 64 c3a0015.adb c3a0015.std.check2 TREE_CONSTANT
      8 64 c3a0015.adb c3a0015.std.check2 is_gimple_constant
      8 64 c3a0015.adb c3a0015.std.check1 TREE_CONSTANT
      8 64 c3a0015.adb c3a0015.std.check1 is_gimple_constant
      8 32 s-fatsfl.ads system.fat_sflt.attr_short_float.valid TREE_CONSTANT
      8 32 s-fatsfl.ads system.fat_sflt.attr_short_float.valid 
is_gimple_constant
      8 32 s-fatllf.ads system.fat_llf.attr_long_long_float.valid TREE_CONSTANT
      8 32 s-fatllf.ads system.fat_llf.attr_long_long_float.valid 
is_gimple_constant
      8 32 s-fatlfl.ads system.fat_lflt.attr_long_float.valid TREE_CONSTANT
      8 32 s-fatlfl.ads system.fat_lflt.attr_long_float.valid is_gimple_constant
      8 32 s-fatflt.ads system.fat_flt.attr_float.valid TREE_CONSTANT
      8 32 s-fatflt.ads system.fat_flt.attr_float.valid is_gimple_constant
      8 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/gomp/pr47963.c foo 
is_gimple_constant
      7 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/array-5.c func 
is_gimple_constant
      7 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/array-5.c func 
is_gimple_constant
      6 64 ../../../../libgomp/testsuite/libgomp.c/examples-4/target_data-3.c 
main is_gimple_constant
      6 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/ice_type.adb ice_type 
TREE_CONSTANT
      6 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/ice_type.adb ice_type 
is_gimple_constant
      6 64 cxac004.adb cxac004 TREE_CONSTANT
      6 64 cxac004.adb cxac004 is_gimple_constant
      6 64 cd7305a.adb cd7305a TREE_CONSTANT
      6 64 cd7305a.adb cd7305a is_gimple_constant
      6 64 cd5014e.adb cd5014e TREE_CONSTANT
      6 64 cd5014e.adb cd5014e is_gimple_constant
      6 64 cd5013e.adb cd5013e TREE_CONSTANT
      6 64 cd5013e.adb cd5013e is_gimple_constant
      6 64 cd1c03f.adb cd1c03f TREE_CONSTANT
      6 64 cd1c03f.adb cd1c03f is_gimple_constant
      6 64 c974014.adb c974014 TREE_CONSTANT
      6 64 c974014.adb c974014 is_gimple_constant
      6 64 c95092a.adb c95092a TREE_CONSTANT
      6 64 c95092a.adb c95092a is_gimple_constant
      6 64 c87b54a.adb c87b54a TREE_CONSTANT
      6 64 c87b54a.adb c87b54a is_gimple_constant
      6 64 c87b06a.adb c87b06a TREE_CONSTANT
      6 64 c87b06a.adb c87b06a is_gimple_constant
      6 64 c74004a.adb c74004a TREE_CONSTANT
      6 64 c74004a.adb c74004a is_gimple_constant
      6 64 c72002a.adb c72002a TREE_CONSTANT
      6 64 c72002a.adb c72002a is_gimple_constant
      6 64 c4a013a.adb c4a013a TREE_CONSTANT
      6 64 c4a013a.adb c4a013a is_gimple_constant
      6 64 c4a011a.adb c4a011a TREE_CONSTANT
      6 64 c4a011a.adb c4a011a is_gimple_constant
      6 64 c49024a.adb c49024a TREE_CONSTANT
      6 64 c49024a.adb c49024a is_gimple_constant
      6 64 c47009b.adb c47009b TREE_CONSTANT
      6 64 c47009b.adb c47009b is_gimple_constant
      6 64 c46032a.adb c46032a TREE_CONSTANT
      6 64 c46032a.adb c46032a is_gimple_constant
      6 64 c46024a.adb c46024a TREE_CONSTANT
      6 64 c46024a.adb c46024a is_gimple_constant
      6 64 c45624b.adb c45624b TREE_CONSTANT
      6 64 c45624b.adb c45624b is_gimple_constant
      6 64 c45624a.adb c45624a TREE_CONSTANT
      6 64 c45624a.adb c45624a is_gimple_constant
      6 64 c45622a.adb c45622a TREE_CONSTANT
      6 64 c45622a.adb c45622a is_gimple_constant
      6 64 c456001.adb c456001 TREE_CONSTANT
      6 64 c456001.adb c456001 is_gimple_constant
      6 64 c45523a.adb c45523a TREE_CONSTANT
      6 64 c45523a.adb c45523a is_gimple_constant
      6 64 c45323a.adb c45323a TREE_CONSTANT
      6 64 c45323a.adb c45323a is_gimple_constant
      6 64 c45322a.adb c45322a TREE_CONSTANT
      6 64 c45322a.adb c45322a is_gimple_constant
      6 64 c44003d.adb c44003d TREE_CONSTANT
      6 64 c44003d.adb c44003d is_gimple_constant
      6 64 c41323a.adb c41323a TREE_CONSTANT
      6 64 c41323a.adb c41323a is_gimple_constant
      6 64 c392003.adb c392003 TREE_CONSTANT
      6 64 c392003.adb c392003 is_gimple_constant
      6 64 c37009a.adb c37009a TREE_CONSTANT
      6 64 c37009a.adb c37009a is_gimple_constant
      6 64 c2a008a.adb c2a008a TREE_CONSTANT
      6 64 c2a008a.adb c2a008a is_gimple_constant
      6 64 c24207a.adb c24207a TREE_CONSTANT
      6 64 c24207a.adb c24207a is_gimple_constant
      6 64 c24203b.adb c24203b TREE_CONSTANT
      6 64 c24203b.adb c24203b is_gimple_constant
      6 32 ../../../../libgomp/testsuite/libgomp.c/examples-4/target_data-3.c 
main is_gimple_constant
      5 64 /tmp/cgo-gcc-input-048096209.c testSendSIG is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/zero_length_subarrays.c
 main is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-4.c
 test_reductions is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-3.c
 test_reductions_minmax is_gimple_cotant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-3.c
 test_reductions is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-2.c
 test_reductions_minmax is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-2.c
 test_reductions is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-1.c
 test_reductions_minmax is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-1.c
 test_reductions is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-1.c
 test_reductions_bool is_gimple_constant
      5 64 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr70688.c
 main is_gimple_constant
      5 64 issue3250.cgo2.c testSendSIG is_gimple_constant
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/stack-check-18.c 
f2 is_gimple_constant
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr50527.c main 
is_gimple_constant
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr47086.c foo 
is_gimple_constant
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr44545.c DrawChunk 
is_gimple_constant
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr43513.c foo3 
is_gimple_constant
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/graphite/pr83277.c wv 
is_gimple_constant
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/graphite/pr83255.c main 
is_gimple_constant
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/c99-const-expr-13.c f 
TREE_CONSTANT
      5 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/c90-const-expr-6.c f 
is_gimple_constant
      5 32 /tmp/cgo-gcc-input-268957210.c testSendSIG is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/zero_length_subarrays.c
 main is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-4.c
 test_reductions is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-3.c
 test_reductions_minmax is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-3.c
 test_reductions is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-2.c
 test_reductions_minmax is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-2.c
 test_reductions is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-1.c
 test_reductions_minmax is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-1.c
 test_reductions is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-1.c
 test_reductions_bool is_gimple_constant
      5 32 
../../../../libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr70688.c
 main is_gimple_constant
      5 32 issue3250.cgo2.c testSendSIG is_gimple_constant
      5 32 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/stack-check-18.c 
f2 is_gimple_constant
      5 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr50527.c main 
is_gimple_constant
      5 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr47086.c foo 
is_gimple_constant
      5 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr44545.c DrawChunk 
is_gimple_constant
      5 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr43513.c foo3 
is_gimple_constant
      5 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/c99-const-expr-13.c f 
TREE_CONSTANT
      5 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/c90-const-expr-6.c f 
is_gimple_constant
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/unchecked_convert7.adb 
unchecked_convert7 TREE_CONSTANT
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/unchecked_convert7.adb 
unchecked_convert7 is_gimple_constant
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline2_pkg.adb 
inline2_pkg.valid_real TREE_CONSTANT
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline2_pkg.adb 
inline2_pkg.valid_real is_gimple_constant
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline2_pkg.adb 
inline2_pkg.invalid_real TREE_CONSTANT
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline2_pkg.adb 
inline2_pkg.invalid_real is_gimple_constant
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline2.adb 
inline2_pkg.valid_real TREE_CONSTANT
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline2.adb 
inline2_pkg.valid_real is_gimple_constant
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline2.adb 
inline2_pkg.invalid_real TREE_CONSTANT
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline2.adb 
inline2_pkg.invalid_real is_gimple_constant
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline1.adb 
inline1_pkg.valid_real TREE_CONSTANT
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline1.adb 
inline1_pkg.valid_real is_gimple_constant
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline1.adb 
inline1_pkg.invalid_real TREE_CONSTANT
      4 64 /home/jakub/src/gcc/gcc/testsuite/gnat.dg/inline1.adb 
inline1_pkg.invalid_real is_gimple_constant
      4 64 ce3815a.adb ce3815a TREE_CONSTANT
      4 64 ce3815a.adb ce3815a is_gimple_constant
      4 64 ce3806a.adb ce3806a TREE_CONSTANT
      4 64 ce3806a.adb ce3806a is_gimple_constant
      4 64 ce3805a.adb ce3805a TREE_CONSTANT
      4 64 ce3805a.adb ce3805a is_gimple_constant
      4 64 ce3804m.adb ce3804m TREE_CONSTANT
      4 64 ce3804m.adb ce3804m is_gimple_constant
      4 64 ce3804c.adb ce3804c TREE_CONSTANT
      4 64 ce3804c.adb ce3804c is_gimple_constant
      4 64 ce2401e.adb ce2401e TREE_CONSTANT
      4 64 ce2401e.adb ce2401e is_gimple_constant
      4 64 ce2201c.adb ce2201c TREE_CONSTANT
      4 64 ce2201c.adb ce2201c is_gimple_constant
      4 64 cc1222a.adb cc1222a.B_1.p2 TREE_CONSTANT
      4 64 cc1222a.adb cc1222a.B_1.p2 is_gimple_constant
      4 64 cc1222a.adb cc1222a.B_1.p1 TREE_CONSTANT
      4 64 cc1222a.adb cc1222a.B_1.p1 is_gimple_constant
      4 64 ca140232.adb ca140232.max_data_val TREE_CONSTANT
      4 64 ca140232.adb ca140232.max_data_val is_gimple_constant
      4 64 c87b47a.adb c87b47a TREE_CONSTANT
      4 64 c87b47a.adb c87b47a is_gimple_constant
      4 64 c87b42a.adb c87b42a TREE_CONSTANT
      4 64 c87b42a.adb c87b42a is_gimple_constant
      4 64 c87b34c.adb c87b34c TREE_CONSTANT
      4 64 c87b34c.adb c87b34c is_gimple_constant
      4 64 c87b07b.adb c87b07b TREE_CONSTANT
      4 64 c87b07b.adb c87b07b is_gimple_constant
      4 64 c83029a.adb c83029a TREE_CONSTANT
      4 64 c83029a.adb c83029a is_gimple_constant
      4 64 c83028a.adb c83028a TREE_CONSTANT
      4 64 c83028a.adb c83028a is_gimple_constant
      4 64 c83025a.adb c83025a TREE_CONSTANT
      4 64 c83025a.adb c83025a is_gimple_constant
      4 64 c83024a.adb c83024a TREE_CONSTANT
      4 64 c83024a.adb c83024a is_gimple_constant
      4 64 c83023a.adb c83023a TREE_CONSTANT
      4 64 c83023a.adb c83023a is_gimple_constant
      4 64 c83022g0m.adb c83022g0m TREE_CONSTANT
      4 64 c83022g0m.adb c83022g0m is_gimple_constant
      4 64 c83022a.adb c83022a TREE_CONSTANT
      4 64 c83022a.adb c83022a is_gimple_constant
      4 64 c35801d.adb c35801d.np3 TREE_CONSTANT
      4 64 c35801d.adb c35801d.np3 is_gimple_constant
      4 64 c35801d.adb c35801d.np2 TREE_CONSTANT
      4 64 c35801d.adb c35801d.np2 is_gimple_constant
      4 64 c35801d.adb c35801d.np1 TREE_CONSTANT
      4 64 c35801d.adb c35801d.np1 is_gimple_constant
      4 64 c35704a.adb c35704a TREE_CONSTANT
      4 64 c35704a.adb c35704a is_gimple_constant
      4 64 c34005c.adb c34005c TREE_CONSTANT
      4 64 c34005c.adb c34005c is_gimple_constant
      4 64 c34005a.adb c34005a TREE_CONSTANT
      4 64 c34005a.adb c34005a is_gimple_constant
      4 64 ada101a.adb ada101a TREE_CONSTANT
      4 64 ada101a.adb ada101a is_gimple_constant

2018-01-12  Jakub Jelinek  <ja...@redhat.com>
            Richard Biener  <rgue...@suse.de>

        PR libgomp/83590
        * gimplify.c (gimplify_one_sizepos): Make sure gimplify_one_sizepos
        doesn't turn something previously non-INTEGER_CST into INTEGER_CST.

--- gcc/gimplify.c.jj   2018-01-11 20:34:15.373975356 +0100
+++ gcc/gimplify.c      2018-01-12 13:57:21.153274727 +0100
@@ -12570,6 +12570,12 @@ gimplify_one_sizepos (tree *expr_p, gimp
   /* SSA names in decl/type fields are a bad idea - they'll get reclaimed
      if the def vanishes.  */
   gimplify_expr (expr_p, stmt_p, NULL, is_gimple_val, fb_rvalue, false);
+
+  /* If expr wasn't already is_gimple_sizepos from the FE, ensure that it
+     is a VAR_DECL, otherwise we might handle some decls as gimplify_vla_decl
+     even when they would have all sizes INTEGER_CSTs.  */
+  if (is_gimple_constant (*expr_p))
+    *expr_p = get_initialized_tmp_var (*expr_p, stmt_p, NULL, false);
 }
 
 /* Gimplify the body of statements of FNDECL and return a GIMPLE_BIND node


        Jakub

Reply via email to