Commit b06479fd by Marek Polacek Committed by Marek Polacek

shift-1.C: New test.

	* g++.dg/ubsan/shift-1.C: New test.
	* gcc.dg/ubsan/c-shift-2.c: New test.
	* c-c++-common/ubsan/shift-5.c: Remove file.

From-SVN: r220631
parent d3f2e41e
2015-02-11 Marek Polacek <polacek@redhat.com>
* g++.dg/ubsan/shift-1.C: New test.
* gcc.dg/ubsan/c-shift-2.c: New test.
* c-c++-common/ubsan/shift-5.c: Remove file.
2015-02-11 Alex Velenko <Alex.Velenko@arm.com>
* gcc.target/aarch64/atomic-op-consume.c (scan-assember-times):
......
......@@ -8,18 +8,10 @@ foo (int x)
/* None of the following should pass. */
switch (x)
{
case 1 >> -1:
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 11 } */
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 11 } */
case -1 >> -1:
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 14 } */
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 14 } */
case 1 << -1:
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 17 } */
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 17 } */
case -1 << -1:
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 20 } */
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 20 } */
case 1 >> -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
case -1 >> -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
case 1 << -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
case -1 << -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
return 1;
}
return 0;
......@@ -31,12 +23,8 @@ bar (int x)
/* None of the following should pass. */
switch (x)
{
case -1 >> 200:
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 34 } */
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 34 } */
case 1 << 200:
/* { dg-error "case label does not reduce to an integer constant" "" { target c } 37 } */
/* { dg-error "is not a constant expression" "" { xfail { *-*-* } } 37 } */
case -1 >> 200: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
case 1 << 200: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
return 1;
}
return 0;
......
/* { dg-do compile } */
/* { dg-options "-fsanitize=shift -w" } */
/* { dg-shouldfail "ubsan" } */
int
foo (int x)
{
/* None of the following should pass. */
switch (x)
{
case 1 >> -1: /* { dg-error "case label does not reduce to an integer constant" } */
case -1 >> -1: /* { dg-error "case label does not reduce to an integer constant" } */
case 1 << -1: /* { dg-error "case label does not reduce to an integer constant" } */
case -1 << -1: /* { dg-error "case label does not reduce to an integer constant" } */
return 1;
}
return 0;
}
int
bar (int x)
{
/* None of the following should pass. */
switch (x)
{
case -1 >> 200: /* { dg-error "case label does not reduce to an integer constant" } */
case 1 << 200: /* { dg-error "case label does not reduce to an integer constant" } */
return 1;
}
return 0;
}
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