Backport r254519

2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-11-08  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82792
	* gimplify.c (expand_FALLTHROUGH_r): Skip IFN_ASAN_MARK.
2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-11-08  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82792
	* g++.dg/asan/pr82792.C: New test.

From-SVN: r255011
This commit is contained in:
Martin Liska 2017-11-21 17:01:43 +01:00 committed by Martin Liska
parent 11f7624968
commit 20dda3e716
4 changed files with 54 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2017-11-21 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-11-08 Martin Liska <mliska@suse.cz>
PR sanitizer/82792
* gimplify.c (expand_FALLTHROUGH_r): Skip IFN_ASAN_MARK.
2017-11-21 Martin Liska <mliska@suse.cz>
Backport from mainline

View File

@ -2203,7 +2203,8 @@ expand_FALLTHROUGH_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
while (!gsi_end_p (gsi2))
{
stmt = gsi_stmt (gsi2);
if (gimple_code (stmt) == GIMPLE_LABEL)
enum gimple_code gc = gimple_code (stmt);
if (gc == GIMPLE_LABEL)
{
tree label = gimple_label_label (as_a <glabel *> (stmt));
if (gimple_has_location (stmt) && DECL_ARTIFICIAL (label))
@ -2212,8 +2213,11 @@ expand_FALLTHROUGH_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
break;
}
}
else if (gc == GIMPLE_CALL
&& gimple_call_internal_p (stmt, IFN_ASAN_MARK))
;
else
/* Something other than a label. That's not expected. */
/* Something other is not expected. */
break;
gsi_next (&gsi2);
}

View File

@ -1,3 +1,11 @@
2017-11-21 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-11-08 Martin Liska <mliska@suse.cz>
PR sanitizer/82792
* g++.dg/asan/pr82792.C: New test.
2017-11-21 Martin Liska <mliska@suse.cz>
Backport from mainline

View File

@ -0,0 +1,32 @@
/* PR sanitizer/82792 */
/* { dg-do compile } */
/* { dg-options "-fsanitize=address" } */
extern int
test (int i, int j)
{
long c;
(c) = 1;
switch (i)
{
case 1:
if (j)
{
c = 1;
}
goto default_case;
case 2:
{
if (j)
{
c = 0;
}
}
__attribute ((fallthrough));
default_case:
default:
c = 0;
break;
}
return 0;
}