cp-gimplify.c (genericize_cp_loop): Change LOOP_EXPR's location to start of loop body instead of start of loop.

gcc/cp/ChangeLog:

2015-11-26  Andreas Arnez  <arnez@linux.vnet.ibm.com>

	* cp-gimplify.c (genericize_cp_loop): Change LOOP_EXPR's location
	to start of loop body instead of start of loop.

gcc/testsuite/ChangeLog:

2015-11-26  Andreas Arnez  <arnez@linux.vnet.ibm.com>

	* g++.dg/guality/pr67192.C: New test.

From-SVN: r230979
This commit is contained in:
Andreas Arnez 2015-11-26 17:52:01 +00:00 committed by Ulrich Weigand
parent 8b95719a65
commit 9daf14d442
4 changed files with 94 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2015-11-26 Andreas Arnez <arnez@linux.vnet.ibm.com>
* cp-gimplify.c (genericize_cp_loop): Change LOOP_EXPR's location
to start of loop body instead of start of loop.
2015-11-26 Jakub Jelinek <jakub@redhat.com>
PR c++/68508

View File

@ -263,7 +263,12 @@ genericize_cp_loop (tree *stmt_p, location_t start_locus, tree cond, tree body,
loop = stmt_list;
}
else
loop = build1_loc (start_locus, LOOP_EXPR, void_type_node, stmt_list);
{
location_t loc = EXPR_LOCATION (expr_first (body));
if (loc == UNKNOWN_LOCATION)
loc = start_locus;
loop = build1_loc (loc, LOOP_EXPR, void_type_node, stmt_list);
}
stmt_list = NULL;
append_to_statement_list (loop, &stmt_list);

View File

@ -1,3 +1,7 @@
2015-11-26 Andreas Arnez <arnez@linux.vnet.ibm.com>
* g++.dg/guality/pr67192.C: New test.
2015-11-26 Matthew Wahab <matthew.wahab@arm.com>
* gcc.target/aarch64/advsimd-intrinsics/vqrdmlXh_lane.inc: New file,

View File

@ -0,0 +1,79 @@
/* PR debug/67192 */
/* { dg-do run } */
/* { dg-options "-x c++ -g -Wmisleading-indentation" } */
volatile int cnt = 0;
__attribute__((noinline, noclone)) static int
last (void)
{
return ++cnt % 5 == 0;
}
__attribute__((noinline, noclone)) static void
do_it (void)
{
asm volatile ("" : : "r" (&cnt) : "memory");
}
__attribute__((noinline, noclone)) static void
f1 (void)
{
for (;; do_it())
{
if (last ())
break;
}
do_it (); /* { dg-final { gdb-test 27 "cnt" "5" } } */
}
__attribute__((noinline, noclone)) static void
f2 (void)
{
while (1)
{
if (last ())
break;
do_it ();
}
do_it (); /* { dg-final { gdb-test 39 "cnt" "10" } } */
}
__attribute__((noinline, noclone)) static void
f3 (void)
{
for (;; do_it())
if (last ())
break;
do_it (); /* { dg-final { gdb-test 48 "cnt" "15" } } */
}
__attribute__((noinline, noclone)) static void
f4 (void)
{
while (1) /* { dg-final { gdb-test 54 "cnt" "15" } } */
if (last ())
break;
else
do_it ();
do_it (); /* { dg-final { gdb-test 59 "cnt" "20" } } */
}
void (*volatile fnp1) (void) = f1;
void (*volatile fnp2) (void) = f2;
void (*volatile fnp3) (void) = f3;
void (*volatile fnp4) (void) = f4;
int
main ()
{
asm volatile ("" : : "r" (&fnp1) : "memory");
asm volatile ("" : : "r" (&fnp2) : "memory");
asm volatile ("" : : "r" (&fnp3) : "memory");
asm volatile ("" : : "r" (&fnp4) : "memory");
fnp1 ();
fnp2 ();
fnp3 ();
fnp4 ();
return 0;
}