diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common')
60 files changed, 157 insertions, 18 deletions
diff --git a/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c b/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c index cf014b0..175d9c3 100644 --- a/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c +++ b/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-fanalyzer-verbosity=2" } */ +/* { dg-additional-options "-fanalyzer-verbosity=2 -fno-exceptions" } */ typedef struct FILE FILE; diff --git a/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c b/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c index b0ece20..8d66c8f 100644 --- a/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c +++ b/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-fanalyzer-verbosity=3" } */ +/* { dg-additional-options "-fanalyzer-verbosity=3 -fno-exceptions" } */ typedef struct FILE FILE; diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c b/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c index ab79514..5329a89 100644 --- a/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c +++ b/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c @@ -1,5 +1,5 @@ extern int const_p (int) __attribute__((const)); -extern void do_stuff (void); +extern void do_stuff (void) __attribute__((nothrow)); void test (int a) { diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c index 1517667..1e2e1f9 100644 --- a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c +++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c @@ -2,7 +2,7 @@ struct foo; extern void foo_release (struct foo *) - __attribute__((nonnull)); + __attribute__((nonnull, nothrow)); extern struct foo *foo_acquire (void) __attribute__ ((malloc (foo_release))); diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c index 7ff4e57..8b7ffc1 100644 --- a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c +++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c @@ -1,7 +1,7 @@ /* Example of extra argument to "malloc" attribute. */ struct foo; -extern void foo_release (int, struct foo *); +extern void foo_release (int, struct foo *) __attribute__((nothrow)); extern struct foo *foo_acquire (void) __attribute__ ((malloc (foo_release, 2))); diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c index 1665d41..45ee406f 100644 --- a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c +++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c @@ -1,4 +1,5 @@ /* Adapted from gcc.dg/Wmismatched-dealloc.c. */ +/* { dg-additional-options "-fno-exceptions" } */ #define A(...) __attribute__ ((malloc (__VA_ARGS__))) diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c index 87ad42a..fd51630 100644 --- a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c +++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c @@ -1,6 +1,8 @@ /* Adapted from linux 5.3.11: drivers/net/wireless/ath/ath10k/usb.c Reduced reproducer for CVE-2019-19078 (leak of struct urb). */ +/* { dg-additional-options "-fno-exceptions" } */ + typedef unsigned char u8; typedef unsigned short u16; diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-exception.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-exception.c new file mode 100644 index 0000000..9f5e2e8 --- /dev/null +++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-exception.c @@ -0,0 +1,17 @@ +/* { dg-additional-options "-fexceptions" } */ + +extern void free (void *); + +/* Not marked "nothrow", so assume it could throw. */ +char *xstrdup (const char *) + __attribute__((malloc (free), returns_nonnull)); + +void test_1 (const char *s, const char *t) +{ + char *p = xstrdup (s); /* { dg-message "allocated here" } */ + char *q = xstrdup (t); /* { dg-warning "leak of 'p'" } */ + /* { dg-message "if .* throws an exception\.\.\." "" { target *-*-* } .-1 } */ + + free (q); + free (p); +} diff --git a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c index b395623..a15ab65 100644 --- a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c +++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex" } */ +/* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex -fno-exceptions" } */ /* { dg-skip-if "c++98 has no noreturn attribute" { c++98_only } } */ #ifdef __cplusplus diff --git a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c index de70583..6fbbce4 100644 --- a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c +++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-symbol-too-complex" } */ +/* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-symbol-too-complex -fno-exceptions" } */ typedef __SIZE_TYPE__ size_t; enum { _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)) }; diff --git a/gcc/testsuite/c-c++-common/analyzer/capacity-2.c b/gcc/testsuite/c-c++-common/analyzer/capacity-2.c index 7d2de4e..3846239 100644 --- a/gcc/testsuite/c-c++-common/analyzer/capacity-2.c +++ b/gcc/testsuite/c-c++-common/analyzer/capacity-2.c @@ -1,5 +1,6 @@ /* { dg-skip-if "" { powerpc*-*-aix* } } */ /* { dg-skip-if "requires hosted libstdc++ for stdlib size_t" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> #include "analyzer-decls.h" diff --git a/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c b/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c index c41b61d..95091e7 100644 --- a/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c +++ b/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c @@ -1,5 +1,7 @@ /* Reduced from coreutils's sum.c: bsd_sum_stream */ +/* { dg-additional-options "-fno-exceptions" } */ + typedef __SIZE_TYPE__ size_t; typedef unsigned char __uint8_t; typedef unsigned long int __uintmax_t; diff --git a/gcc/testsuite/c-c++-common/analyzer/data-model-22.c b/gcc/testsuite/c-c++-common/analyzer/data-model-22.c index 8429b2f..65bf346 100644 --- a/gcc/testsuite/c-c++-common/analyzer/data-model-22.c +++ b/gcc/testsuite/c-c++-common/analyzer/data-model-22.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + #include <string.h> #include "analyzer-decls.h" diff --git a/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c b/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c index a86d506..bb45917 100644 --- a/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c +++ b/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ /* A toy re-implementation of CPython's object model. */ diff --git a/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c b/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c index d7058ea..0609dc8 100644 --- a/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c @@ -3,7 +3,7 @@ static int *__attribute__((noinline)) callee (void) { - return NULL; + return NULL; /* { dg-message "using NULL here" } */ } void test_1 (void) diff --git a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c index 7431bd1..b790997 100644 --- a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c +++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c @@ -1,4 +1,5 @@ /* Reduced from git-2.39.0's pack-revindex.c */ +/* { dg-additional-options "-fno-exceptions" } */ typedef unsigned int __uint32_t; typedef unsigned long int __uintmax_t; diff --git a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c index 7123cf5..a7f8049 100644 --- a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c +++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c @@ -1,6 +1,7 @@ /* Reduced from haproxy-2.7.1: src/tcpcheck.c. */ /* { dg-additional-options "-Wno-analyzer-too-complex" } */ +/* { dg-additional-options "-fno-exceptions" } */ typedef __SIZE_TYPE__ size_t; diff --git a/gcc/testsuite/c-c++-common/analyzer/edges-2.c b/gcc/testsuite/c-c++-common/analyzer/edges-2.c index 7e4543c..df4bfaa 100644 --- a/gcc/testsuite/c-c++-common/analyzer/edges-2.c +++ b/gcc/testsuite/c-c++-common/analyzer/edges-2.c @@ -1,5 +1,7 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ + #include <stdlib.h> int foo (); diff --git a/gcc/testsuite/c-c++-common/analyzer/fd-2.c b/gcc/testsuite/c-c++-common/analyzer/fd-2.c index 10c9ecd..b6b0a57 100644 --- a/gcc/testsuite/c-c++-common/analyzer/fd-2.c +++ b/gcc/testsuite/c-c++-common/analyzer/fd-2.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + int open(const char *, int mode); void close(int fd); #define O_RDONLY 0 @@ -61,4 +63,4 @@ test_5 (const char *path, mode_t mode) int fd = creat (path, mode); close(fd); close(fd); /* { dg-warning "double 'close' of file descriptor 'fd' \\\[CWE-1341\\\]" "warning" } */ -}
\ No newline at end of file +} diff --git a/gcc/testsuite/c-c++-common/analyzer/fd-3.c b/gcc/testsuite/c-c++-common/analyzer/fd-3.c index 8e71b14..4894b64 100644 --- a/gcc/testsuite/c-c++-common/analyzer/fd-3.c +++ b/gcc/testsuite/c-c++-common/analyzer/fd-3.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + int open(const char *, int mode); void close(int fd); int write (int fd, void *buf, int nbytes); diff --git a/gcc/testsuite/c-c++-common/analyzer/fd-meaning.c b/gcc/testsuite/c-c++-common/analyzer/fd-meaning.c index 6a9ec92..bd0d458a 100644 --- a/gcc/testsuite/c-c++-common/analyzer/fd-meaning.c +++ b/gcc/testsuite/c-c++-common/analyzer/fd-meaning.c @@ -1,4 +1,5 @@ - /* { dg-additional-options "-fanalyzer-verbose-state-changes" } */ +/* { dg-additional-options "-fno-exceptions" } */ +/* { dg-additional-options "-fanalyzer-verbose-state-changes" } */ int open(const char *, int mode); void close(int fd); @@ -34,4 +35,4 @@ void test_3 (const char* path) close(fd); /* { dg-message "meaning: \\{verb: 'release', noun: 'resource'\\}" } */ close(fd); /* { dg-warning "double 'close' of file descriptor 'fd' \\\[CWE-1341\\\]" } */ } -}
\ No newline at end of file +} diff --git a/gcc/testsuite/c-c++-common/analyzer/file-1.c b/gcc/testsuite/c-c++-common/analyzer/file-1.c index 316cbb3..e87cf73 100644 --- a/gcc/testsuite/c-c++-common/analyzer/file-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/file-1.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + typedef struct FILE FILE; FILE* fopen (const char*, const char*); diff --git a/gcc/testsuite/c-c++-common/analyzer/file-3.c b/gcc/testsuite/c-c++-common/analyzer/file-3.c index 8f93a98..ca992bf 100644 --- a/gcc/testsuite/c-c++-common/analyzer/file-3.c +++ b/gcc/testsuite/c-c++-common/analyzer/file-3.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + typedef struct _IO_FILE FILE; extern struct _IO_FILE *stderr; diff --git a/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c b/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c index 66b72a7..c9aee5e 100644 --- a/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c @@ -1,3 +1,4 @@ +/* { dg-additional-options "-fno-exceptions" } */ /* { dg-additional-options "-fanalyzer-verbose-state-changes" } */ typedef struct FILE FILE; diff --git a/gcc/testsuite/c-c++-common/analyzer/hard-reg-1.c b/gcc/testsuite/c-c++-common/analyzer/hard-reg-1.c new file mode 100644 index 0000000..d22a5b5 --- /dev/null +++ b/gcc/testsuite/c-c++-common/analyzer/hard-reg-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target x86_64-*-* } } */ + +void * +get_from_hard_reg (void) +{ + register void *sp asm ("sp"); + return sp; +} diff --git a/gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c b/gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c index 6b7d25c..bbbb68e 100644 --- a/gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c +++ b/gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + extern void marker_A(void); extern void marker_B(void); extern void marker_C(void); diff --git a/gcc/testsuite/c-c++-common/analyzer/leak-3.c b/gcc/testsuite/c-c++-common/analyzer/leak-3.c index a386d88..19d7501 100644 --- a/gcc/testsuite/c-c++-common/analyzer/leak-3.c +++ b/gcc/testsuite/c-c++-common/analyzer/leak-3.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c b/gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c index 8653c67..c296061 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c b/gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c index e7179f0..0d86801 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> #include "../../gcc.dg/analyzer/analyzer-decls.h" diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c b/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c index 6ee30f3..5daa696 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c index f03f978..4a1870d 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdio.h> #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c index 766bbe7..12b93b2 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c index 77e3e02..8af84ed 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c @@ -1,3 +1,4 @@ +/* { dg-additional-options "-fno-exceptions" } */ /* { dg-additional-options "-fanalyzer-transitivity" } */ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c index 4e40833..ffb0ffe 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c @@ -1,3 +1,4 @@ +/* { dg-additional-options "-fno-exceptions" } */ /* { dg-additional-options "-fno-analyzer-call-summaries -fanalyzer-transitivity" } */ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c index 36ec510..052b401 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> #include "analyzer-decls.h" diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c index 70b3edd..258706c 100644 --- a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c +++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> #include "analyzer-decls.h" diff --git a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c index c5f1fa4..4f04e46 100644 --- a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c +++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c @@ -66,7 +66,7 @@ static inline struct connection *__objt_conn(enum obj_type *t) static inline struct connection *objt_conn(enum obj_type *t) { if (!t || *t != OBJ_TYPE_CONN) - return (struct connection *) ((void *)0); + return (struct connection *) ((void *)0); /* { dg-message "using NULL here" } */ return __objt_conn(t); } struct session { @@ -85,7 +85,7 @@ smp_fetch_ssl_fc_has_early(const struct arg *args, struct sample *smp, const cha SSL *ssl; struct connection *conn; - conn = objt_conn(smp->sess->origin); + conn = objt_conn(smp->sess->origin); /* { dg-message "return of NULL" } */ ssl = ssl_sock_get_ssl_object(conn); if (!ssl) return 0; diff --git a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c index 9dcf7aa..0ebeeff 100644 --- a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c +++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c @@ -60,7 +60,7 @@ void WuExpireSessionKey(WEBUI *wu) for(i=0; i<LIST_NUM(wu->Contexts); i++) { - STRMAP_ENTRY *entry = (STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i); + STRMAP_ENTRY *entry = (STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i); /* { dg-message "'entry' is NULL" } */ WU_CONTEXT *context = (WU_CONTEXT*)entry->Value; /* { dg-bogus "dereference of NULL 'entry'" "PR analyzer/108400" { xfail *-*-* } } */ if(context->ExpireDate < Tick64()) { diff --git a/gcc/testsuite/c-c++-common/analyzer/paths-7.c b/gcc/testsuite/c-c++-common/analyzer/paths-7.c index 2743de5..f7c5cbf 100644 --- a/gcc/testsuite/c-c++-common/analyzer/paths-7.c +++ b/gcc/testsuite/c-c++-common/analyzer/paths-7.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> #include "analyzer-decls.h" diff --git a/gcc/testsuite/c-c++-common/analyzer/pr110830.c b/gcc/testsuite/c-c++-common/analyzer/pr110830.c index f5a39b7..ebfd38d 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr110830.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr110830.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + typedef __SIZE_TYPE__ size_t; void free(void *); diff --git a/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c b/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c index 4a08f0f1..e389e43 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c @@ -1,4 +1,5 @@ /* { dg-do "compile" } */ +/* { dg-additional-options "-fno-exceptions" } */ /* Minimal replacement of system headers. */ #define NULL ((void *) 0) diff --git a/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c index 50d3388..19a3023 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c @@ -3,6 +3,7 @@ Adapted from intl/localealias.c, with all #includes removed. */ /* { dg-do "compile" } */ +/* { dg-additional-options "-fno-exceptions" } */ /* Handle aliases for locale names. Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc. diff --git a/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c index 6f65add..45517468 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c @@ -3,6 +3,7 @@ Adapted from intl/localealias.c, with all #includes removed. */ /* { dg-do "compile" } */ +/* { dg-additional-options "-fno-exceptions" } */ /* Handle aliases for locale names. Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc. diff --git a/gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c b/gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c index b20630b..fb194ad 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c @@ -1,4 +1,5 @@ /* { dg-additional-options "-O2 -fanalyzer-transitivity" } */ +/* { dg-additional-options "-fno-exceptions" } */ int *wf; diff --git a/gcc/testsuite/c-c++-common/analyzer/pr97072.c b/gcc/testsuite/c-c++-common/analyzer/pr97072.c index 4024124..82411a1 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr97072.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr97072.c @@ -1,4 +1,4 @@ -void unknown_fn_1 (void *); +void unknown_fn_1 (void *) __attribute__((nothrow)); void test_1 (int co, int y) { diff --git a/gcc/testsuite/c-c++-common/analyzer/pr98575-1.c b/gcc/testsuite/c-c++-common/analyzer/pr98575-1.c index 6472e76..b8ddf77 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr98575-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr98575-1.c @@ -4,7 +4,7 @@ void **g; -extern void unknown_fn (void); +extern void unknown_fn (void) __attribute__((nothrow)); /* Without a call to unknown_fn. */ diff --git a/gcc/testsuite/c-c++-common/analyzer/pr99716-1.c b/gcc/testsuite/c-c++-common/analyzer/pr99716-1.c index 41be8ca..60f3a598 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr99716-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr99716-1.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + typedef struct FILE FILE; FILE* fopen (const char*, const char*); diff --git a/gcc/testsuite/c-c++-common/analyzer/pr99716-2.c b/gcc/testsuite/c-c++-common/analyzer/pr99716-2.c index ef7cc5f..caf5c86 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr99716-2.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr99716-2.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib rand" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ /* Reduced from https://github.com/libguestfs/libguestfs/blob/e0a11061035d47b118c95706240bcc17fd576edc/tests/mount-local/test-parallel-mount-local.c#L299-L335 diff --git a/gcc/testsuite/c-c++-common/analyzer/pr99716-3.c b/gcc/testsuite/c-c++-common/analyzer/pr99716-3.c index 414d57e..98f656f 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pr99716-3.c +++ b/gcc/testsuite/c-c++-common/analyzer/pr99716-3.c @@ -1,4 +1,5 @@ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/analyzer/pragma-2.c b/gcc/testsuite/c-c++-common/analyzer/pragma-2.c index bd96a25..f309876 100644 --- a/gcc/testsuite/c-c++-common/analyzer/pragma-2.c +++ b/gcc/testsuite/c-c++-common/analyzer/pragma-2.c @@ -1,6 +1,7 @@ /* { dg-skip-if "" { powerpc*-*-aix* } } */ /* Verify that we can disable -Wanalyzer-too-complex via pragmas. */ /* { dg-additional-options "-Wanalyzer-too-complex -Werror=analyzer-too-complex -fno-analyzer-state-merge -g" } */ +/* { dg-additional-options "-fno-exceptions" } */ /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c b/gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c index 9f6ccb6..9606044 100644 --- a/gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c +++ b/gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + #include <stdio.h> #define INI_MAX_LINE 200 diff --git a/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c b/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c new file mode 100644 index 0000000..ac5169e --- /dev/null +++ b/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c @@ -0,0 +1,44 @@ +/* See e.g. https://en.cppreference.com/w/c/io/fprintf + and https://www.man7.org/linux/man-pages/man3/sprintf.3.html */ + +extern int +sprintf(char* dst, const char* fmt, ...) + __attribute__((__nothrow__)); + +#include "../../gcc.dg/analyzer/analyzer-decls.h" + +void test_text_ok (void) +{ + char buf[16]; + sprintf (buf, "hello world"); +} + +void test_text_oob (void) +{ + char buf[3]; + sprintf (buf, "hello world"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */ +} + +void test_percent_s_ok (void) +{ + char buf[16]; + sprintf (buf, "%s", "foo"); +} + +void test_percent_s_oob (void) +{ + char buf[3]; + sprintf (buf, "%s", "foo"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */ +} + +void test_percent_i_ok (void) +{ + char buf[16]; + sprintf (buf, "%i", "42"); +} + +void test_percent_i_oob (void) +{ + char buf[4]; + sprintf (buf, "%i", "1066"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */ +} diff --git a/gcc/testsuite/c-c++-common/analyzer/strndup-1.c b/gcc/testsuite/c-c++-common/analyzer/strndup-1.c index 3f90afe..915f220 100644 --- a/gcc/testsuite/c-c++-common/analyzer/strndup-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/strndup-1.c @@ -1,6 +1,7 @@ /* { dg-skip-if "no strndup in libc" { *-*-darwin[789]* *-*-darwin10* hppa*-*-hpux* *-*-mingw* *-*-vxworks* } } */ /* { dg-additional-options "-D_POSIX_C_SOURCE=200809L" } */ /* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */ +/* { dg-additional-options "-fno-exceptions" } */ #include <string.h> #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c index 868c393..1aa4159 100644 --- a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c +++ b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c @@ -2,6 +2,7 @@ region_model_context_decorator::add_note. */ /* { dg-additional-options "-Wno-analyzer-write-to-string-literal" } */ +/* { dg-additional-options "-fno-exceptions" } */ typedef __SIZE_TYPE__ size_t; diff --git a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c index 971e8f3..b60fba0 100644 --- a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c +++ b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-fno-exceptions" } */ + typedef __SIZE_TYPE__ size_t; int getrandom (void *__buffer, size_t __length, /* { dg-line getrandom } */ diff --git a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c index 2ecad8c..78b2204 100644 --- a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c +++ b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c @@ -2,6 +2,7 @@ notes) works. */ /* { dg-additional-options "-fanalyzer-show-duplicate-count" } */ +/* { dg-additional-options "-fno-exceptions" } */ #include "../../gcc.dg/analyzer/analyzer-decls.h" diff --git a/gcc/testsuite/c-c++-common/analyzer/zlib-5.c b/gcc/testsuite/c-c++-common/analyzer/zlib-5.c index 1e3746d..fa82e43 100644 --- a/gcc/testsuite/c-c++-common/analyzer/zlib-5.c +++ b/gcc/testsuite/c-c++-common/analyzer/zlib-5.c @@ -1,4 +1,5 @@ /* { dg-additional-options "-O3" } */ +/* { dg-additional-options "-fno-exceptions" } */ #include "analyzer-decls.h" diff --git a/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c b/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c new file mode 100644 index 0000000..734da21 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c @@ -0,0 +1,15 @@ +/* PR c/118838 */ +/* { dg-do compile } */ +/* { dg-additional-options "-Wunknown-pragmas" } */ + +/* Make sure the warnings are suppressed as expected. */ + +/* The tokens need to be all on the same line here. */ +_Pragma ("GCC diagnostic push") _Pragma ("GCC diagnostic ignored \"-Wunknown-pragmas\"") _Pragma ("__unknown__") _Pragma ("GCC diagnostic pop") + +#define MACRO \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wunknown-pragmas\"") \ + _Pragma ("__unknown__") \ + _Pragma ("GCC diagnostic pop") +MACRO diff --git a/gcc/testsuite/c-c++-common/musttail14.c b/gcc/testsuite/c-c++-common/musttail14.c index 56a52b8..5bda742 100644 --- a/gcc/testsuite/c-c++-common/musttail14.c +++ b/gcc/testsuite/c-c++-common/musttail14.c @@ -1,5 +1,5 @@ /* PR tree-optimization/118430 */ -/* { dg-do compile { target musttail } } */ +/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ /* { dg-final { scan-tree-dump-times " \[^\n\r]* = bar \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ /* { dg-final { scan-tree-dump-times " \[^\n\r]* = freddy \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ diff --git a/gcc/testsuite/c-c++-common/musttail22.c b/gcc/testsuite/c-c++-common/musttail22.c index eb81249..7dc0f19 100644 --- a/gcc/testsuite/c-c++-common/musttail22.c +++ b/gcc/testsuite/c-c++-common/musttail22.c @@ -1,5 +1,5 @@ /* PR tree-optimization/118430 */ -/* { dg-do compile { target musttail } } */ +/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ /* { dg-final { scan-tree-dump-times " \[^\n\r]* = bar \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ /* { dg-final { scan-tree-dump-times " \[^\n\r]* = freddy \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ |