summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr84131.c
blob: 0ba96516fe31b6be330f6009b3da1fec5436dec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* PR 94131 - ICE on printf with a VLA string and -fno-tree-ccp
   -fno-tree-forwprop
   { dg-do compile }
   { dg-options "-O1 -fno-tree-ccp -fno-tree-forwprop" } */

void rv1 (int n)
{
  char a[n];
  __INTPTR_TYPE__ i = (__INTPTR_TYPE__ )&a[0];
  i &= 3;

  __builtin_memset (a, '\0', sizeof a);
  __builtin_printf ("%s", i ? &a[0] : "");
}


void sink (void*);

void rv2 (int n)
{
  char a[n];
  __INTPTR_TYPE__ i = (__INTPTR_TYPE__)&a[0];
  i &= 3;

  __builtin_memset (a, '\0', sizeof a);
  __builtin_printf ("%s", i ? &a[0] : "");

  sink (a);
}