+++ /dev/null
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wstrict-overflow=3" } */
-typedef __UINTPTR_TYPE__ ptrcast;
-
-volatile unsigned long *
-sat_add(volatile unsigned long *ptr, unsigned long i, volatile unsigned long *end)
-{
- if ((ptrcast)ptr + i * sizeof(*ptr) > (ptrcast)ptr) /* { dg-bogus "pointer wraparound" } */
- return ptr + i;
- else
- return end;
-}
-
-
+++ /dev/null
-/* PR tree-optimization/48022 */
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wstrict-overflow" } */
-
-int
-foo (const char *x)
-{
- unsigned long l = 1;
- const unsigned char *s = (const unsigned char *) (const char *) (x);
- int r = s[0] - ((const unsigned char *) (const char *) ("/"))[0];
- if (l > 0 && r == 0)
- r = (s[1] - ((const unsigned char *) (const char *) ("/"))[1]);
- return r;
-}
+++ /dev/null
-/* PR tree-optimization/48022 */
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wstrict-overflow" } */
-
-#include <string.h>
-
-int
-foo (const char *x)
-{
- return strcmp (x, "/");
-}
+++ /dev/null
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wstrict-overflow" } */
-
-struct glyph
-{
- long foo, bar, baz;
-};
-
-extern int fatal (char const *, int, int);
-
-int
-check_image_width (int width, int height)
-{
- if ((((((0 * (0 * 2 + width) - 1) < 0) ? - (~ (0 * (0 * 2 + width) + 0) == -1) - ((((0 * (0 * 2 + width) + 1) << (sizeof ((0 * 2 + width) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * 2 + width) + 0))) < 0 ? (2 < 0 ? width < ((((0 * (0 * 2 + width) - 1) < 0) ? - (~ (0 * (0 * 2 + width) + 0) == -1) - ((((0 * (0 * 2 + width) + 1) << (sizeof ((0 * 2 + width) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * 2 + width) + 0))) - 2 : ((((0 * (0 * 2 + width) - 1) < 0) ? ((((0 * (0 * 2 + width) + 1) << (sizeof ((0 * 2 + width) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * 2 + width) - 1))) - 2 < width) : width < 0 ? 2 <= width + 2 : 2 < 0 ? width <= width + 2 : width + 2 < 2)
- || ((((((0 * (0 * height + (width + 2)) - 1) < 0) ? - (~ (0 * (0 * height + (width + 2)) + 0) == -1) - ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) + 0))) == 0 && (((width + 2) < 0 && 0 < height) || (height < 0 && 0 < (width + 2)))) || (height < 0 ? ((width + 2) < 0 ? (width + 2) < ((((0 * (0 * height + (width + 2)) - 1) < 0) ? ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) - 1))) / height : height == -1 ? 0 : ((((0 * (0 * height + (width + 2)) - 1) < 0) ? - (~ (0 * (0 * height + (width + 2)) + 0) == -1) - ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) + 0))) / height < (width + 2)) : height == 0 ? 0 : ((width + 2) < 0 ? (width + 2) < ((((0 * (0 * height + (width + 2)) - 1) < 0) ? - (~ (0 * (0 * height + (width + 2)) + 0) == -1) - ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) + 0))) / height : ((((0 * (0 * height + (width + 2)) - 1) < 0) ? ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) - 1))) / height < (width + 2))))
- || ((9223372036854775807L < 18446744073709551615UL ? 9223372036854775807L : 18446744073709551615UL) / sizeof (struct glyph)
- < (width + 2) * height))
- fatal ("screen size %dx%d too big", width, height);
-}
+++ /dev/null
-/* { dg-do compile } */
-/* { dg-options "-Wstrict-overflow -O2" } */
-extern int foo (int);
-
-int
-wait_reading_process_output (void)
-{
- int nfds = 0;
- int channel;
-
- for (channel = 0; channel < 1024; ++channel)
- {
- if (foo (channel))
- nfds++;
- }
-
- if (nfds < 0) /* { dg-bogus "assuming signed overflow does not occur" "" } */
- return 1;
- return 0;
-}
/* { dg-do compile } */
-/* { dg-options "-O2 -Wall -fno-strict-overflow -Wstrict-overflow=2 -fsanitize=signed-integer-overflow" } */
+/* { dg-options "-O2 -Wall -fsanitize=signed-integer-overflow" } */
#include <stdio.h>
/* { dg-do compile } */
-/* { dg-options "-Wswitch-enum -Wsign-compare -fstrict-overflow -Wstrict-overflow -Werror -Wno-error=switch-enum" } */
-/* PR c/66098 - #pragma diagnostic 'ignored' not fully undone by pop for strict-overflow
- PR c/66711 - GCC does not correctly restore diagnostic state after pragma GCC diagnostic pop with -Werror
-*/
+/* { dg-options "-Wswitch-enum -Wsign-compare -fstrict-overflow -Werror -Wno-error=switch-enum" } */
/* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */
-void testing2() {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstrict-overflow"
- int j = 4;
- j + 4 < j;
-#pragma GCC diagnostic pop
-}
-
-void testing3() {
- int k = 4;
- k + 4 < k; /* { dg-error "overflow" "" { xfail *-*-* } } */
-}
-
+/* PR c/66711 - GCC does not correctly restore diagnostic state after pragma GCC diagnostic pop with -Werror */
int bar()
{
unsigned x = 0;