Commit 95bb6e7a by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/91024 (-Wimplicit-fallthrough is confused by likely/unlikely attributes)

	PR c++/91024
	* gimplify.c (collect_fallthrough_labels): Ignore GIMPLE_PREDICT
	statements.

	* g++.dg/warn/Wimplicit-fallthrough-4.C: New test.

From-SVN: r272764
parent 12213acb
2019-06-27 Jakub Jelinek <jakub@redhat.com> 2019-06-27 Jakub Jelinek <jakub@redhat.com>
PR c++/91024
* gimplify.c (collect_fallthrough_labels): Ignore GIMPLE_PREDICT
statements.
PR tree-optimization/91010 PR tree-optimization/91010
* tree-vect-stmts.c (scan_operand_equal_p): If offset1 == offset2, * tree-vect-stmts.c (scan_operand_equal_p): If offset1 == offset2,
return true. Otherwise, don't call operand_equal_p if offset1 or return true. Otherwise, don't call operand_equal_p if offset1 or
......
...@@ -2120,6 +2120,8 @@ collect_fallthrough_labels (gimple_stmt_iterator *gsi_p, ...@@ -2120,6 +2120,8 @@ collect_fallthrough_labels (gimple_stmt_iterator *gsi_p,
} }
else if (gimple_call_internal_p (gsi_stmt (*gsi_p), IFN_ASAN_MARK)) else if (gimple_call_internal_p (gsi_stmt (*gsi_p), IFN_ASAN_MARK))
; ;
else if (gimple_code (gsi_stmt (*gsi_p)) == GIMPLE_PREDICT)
;
else if (!is_gimple_debug (gsi_stmt (*gsi_p))) else if (!is_gimple_debug (gsi_stmt (*gsi_p)))
prev = gsi_stmt (*gsi_p); prev = gsi_stmt (*gsi_p);
gsi_next (gsi_p); gsi_next (gsi_p);
......
2019-06-27 Jakub Jelinek <jakub@redhat.com> 2019-06-27 Jakub Jelinek <jakub@redhat.com>
PR c++/91024
* g++.dg/warn/Wimplicit-fallthrough-4.C: New test.
PR tree-optimization/91010 PR tree-optimization/91010
* g++.dg/vect/simd-10.cc: New test. * g++.dg/vect/simd-10.cc: New test.
......
// PR c++/91024
// { dg-do compile { target c++11 } }
// { dg-options "-Wimplicit-fallthrough" }
int
foo (char c)
{
int result = 0;
switch (c)
{
case 'O':
case 'K':
return result;
[[unlikely]] case 'X': // { dg-bogus "this statement may fall through" }
case 'x': // { dg-bogus "here" }
return result;
default:
break;
}
return result;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment