From: Jason Merrill Date: Sat, 9 May 2015 04:50:19 +0000 (-0400) Subject: memcmp-1.c: Fix narrowing. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=045a58e4556e51ef5dd2e4fc8a27ca1f715456a9;p=gcc.git memcmp-1.c: Fix narrowing. gcc/testsuite/ * c-c++-common/asan/memcmp-1.c: Fix narrowing. * c-c++-common/asan/no-asan-stack.c: Fix narrowing. * c-c++-common/torture/vector-shift1.c: Fix narrowing. * c-c++-common/torture/vshuf-2.inc: Fix narrowing. * g++.dg/torture/pr33572.C: Compile with -std=c++98. From-SVN: r222963 --- diff --git a/gcc/testsuite/c-c++-common/asan/memcmp-1.c b/gcc/testsuite/c-c++-common/asan/memcmp-1.c index c582e3d0cb3..21033f7a08c 100644 --- a/gcc/testsuite/c-c++-common/asan/memcmp-1.c +++ b/gcc/testsuite/c-c++-common/asan/memcmp-1.c @@ -9,8 +9,8 @@ volatile int one = 1; int main () { - char a1[] = {one, 2, 3, 4}; - char a2[] = {1, 2*one, 3, 4}; + char a1[] = {(char)one, 2, 3, 4}; + char a2[] = {1, (char)(2*one), 3, 4}; int res = memcmp (a1, a2, 5 + one); return res; } diff --git a/gcc/testsuite/c-c++-common/asan/no-asan-stack.c b/gcc/testsuite/c-c++-common/asan/no-asan-stack.c index 0f65ab3f7ac..59ae55b0b00 100644 --- a/gcc/testsuite/c-c++-common/asan/no-asan-stack.c +++ b/gcc/testsuite/c-c++-common/asan/no-asan-stack.c @@ -7,8 +7,8 @@ volatile int one = 1; int main () { - volatile char a1[] = {one, 2, 3, 4}; - volatile char a2[] = {1, 2*one, 3, 4}; + volatile char a1[] = {(char)one, 2, 3, 4}; + volatile char a2[] = {1, (char)(2*one), 3, 4}; volatile int res = memcmp ((void *)a1,(void *)a2, 5 + one); return 0; } diff --git a/gcc/testsuite/c-c++-common/torture/vector-shift1.c b/gcc/testsuite/c-c++-common/torture/vector-shift1.c index e6e31daf578..c80d7cccdfd 100644 --- a/gcc/testsuite/c-c++-common/torture/vector-shift1.c +++ b/gcc/testsuite/c-c++-common/torture/vector-shift1.c @@ -2,7 +2,7 @@ #define vector __attribute__((vector_size(8*sizeof(short)))) int main (int argc, char *argv[]) { - vector short v0 = {argc,2,3,4,5,6,7}; + vector short v0 = {(short)argc,2,3,4,5,6,7}; vector short v1 = {2,2,2,2,2,2,2}; vector short r1,r2,r3,r4; int i = 8; diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-2.inc b/gcc/testsuite/c-c++-common/torture/vshuf-2.inc index ef778e59418..bc2179414aa 100644 --- a/gcc/testsuite/c-c++-common/torture/vshuf-2.inc +++ b/gcc/testsuite/c-c++-common/torture/vshuf-2.inc @@ -11,7 +11,7 @@ struct S struct S tests[] = { { { A, B }, { 0, 1 }, { A, B } }, - { { A, B }, { -16, -1 }, { A, B } }, + { { A, B }, { -16U, -1U }, { A, B } }, { { A, B }, { 1, 0 }, { B, A } }, { { A, B }, { 0, 0 }, { A, A } }, { { X, Y }, { 1, 1 }, { Y, Y } }, diff --git a/gcc/testsuite/g++.dg/torture/pr33572.C b/gcc/testsuite/g++.dg/torture/pr33572.C index 91cd073fd22..b4db2ac662b 100644 --- a/gcc/testsuite/g++.dg/torture/pr33572.C +++ b/gcc/testsuite/g++.dg/torture/pr33572.C @@ -1,4 +1,6 @@ // { dg-do run } +// { dg-options "-std=c++98" } + #include #include