[testsuite] Add missing require-effective-target directives in gcc.dg

Add some missing require-effect-targets directives (alloca, indirect_jumps,
label_values and nonlocal_goto).

Tested on nvptx.

gcc/testsuite/ChangeLog:

	* gcc.dg/Warray-bounds-46.c: Add missing require-effective-target
	directive.
	* gcc.dg/Warray-bounds-48.c: Same.
	* gcc.dg/Warray-bounds-50.c: Same.
	* gcc.dg/Wreturn-local-addr-2.c: Same.
	* gcc.dg/Wreturn-local-addr-3.c: Same.
	* gcc.dg/Wreturn-local-addr-4.c: Same.
	* gcc.dg/Wreturn-local-addr-6.c: Same.
	* gcc.dg/Wstack-usage.c: Same.
	* gcc.dg/Wstringop-overflow-15.c: Same.
	* gcc.dg/Wstringop-overflow-23.c: Same.
	* gcc.dg/Wstringop-overflow-25.c: Same.
	* gcc.dg/Wstringop-overflow-27.c: Same.
	* gcc.dg/Wstringop-overflow-39.c: Same.
	* gcc.dg/analyzer/alloca-leak.c: Same.
	* gcc.dg/analyzer/data-model-1.c: Same.
	* gcc.dg/analyzer/data-model-16.c: Same.
	* gcc.dg/analyzer/malloc-1.c: Same.
	* gcc.dg/analyzer/malloc-paths-8.c: Same.
	* gcc.dg/analyzer/pr93546.c: Same.
	* gcc.dg/analyzer/setjmp-1.c: Same.
	* gcc.dg/analyzer/setjmp-2.c: Same.
	* gcc.dg/analyzer/setjmp-3.c: Same.
	* gcc.dg/analyzer/setjmp-4.c: Same.
	* gcc.dg/analyzer/setjmp-5.c: Same.
	* gcc.dg/analyzer/setjmp-6.c: Same.
	* gcc.dg/analyzer/setjmp-7.c: Same.
	* gcc.dg/analyzer/setjmp-7a.c: Same.
	* gcc.dg/analyzer/setjmp-8.c: Same.
	* gcc.dg/analyzer/setjmp-9.c: Same.
	* gcc.dg/analyzer/setjmp-pr93378.c: Same.
	* gcc.dg/gimplefe-44.c: Same.
	* gcc.dg/pr84131.c: Same.
	* gcc.dg/pr93986.c: Same.
	* gcc.dg/pr95133.c: Same.
	* gcc.dg/pr95857.c: Same.
	* gcc.dg/strlenopt-83.c: Same.
	* gcc.dg/strlenopt-84.c: Same.
	* gcc.dg/strlenopt-91.c: Same.
	* gcc.dg/uninit-32.c: Same.
	* gcc.dg/uninit-36.c: Same.
This commit is contained in:
Tom de Vries 2020-08-07 08:59:04 +02:00
parent fe8d7fec4d
commit ebd203778c
40 changed files with 66 additions and 20 deletions

View file

@ -3,7 +3,8 @@
Test to verify that past-the-end accesses by string functions to member
arrays by-reference objects are diagnosed.
{ dg-do compile }
{ dg-options "-O2 -Wall -Wno-unused-local-typedefs -Wno-stringop-overflow -ftrack-macro-expansion=0" } */
{ dg-options "-O2 -Wall -Wno-unused-local-typedefs -Wno-stringop-overflow -ftrack-macro-expansion=0" }
{ dg-require-effective-target alloca } */
#define SA(expr) typedef int StaticAssert [2 * !!(expr) - 1]

View file

@ -1,7 +1,8 @@
/* PR middle-end/91647 - missing -Warray-bounds accessing a zero-length array
of a declared object
{ dg-do "compile" }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
typedef __INT16_TYPE__ int16_t;
typedef __INT32_TYPE__ int32_t;

View file

@ -1,6 +1,7 @@
/* PR middle-end/92349 - ICE in -Warray-bounds on a VLA member
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
typedef __SIZE_TYPE__ size_t;

View file

@ -1,6 +1,7 @@
/* PR c/71924 - missing -Wreturn-local-addr returning alloca result
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
#define ATTR(...) __attribute__ ((__VA_ARGS__))

View file

@ -1,6 +1,7 @@
/* PR c/71924 - missing -Wreturn-local-addr returning alloca result
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
#define ATTR(...) __attribute__ ((__VA_ARGS__))

View file

@ -1,6 +1,7 @@
/* PR c/71924 - missing -Wreturn-local-addr returning alloca result
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
#define ATTR(...) __attribute__ ((__VA_ARGS__))

View file

@ -1,6 +1,7 @@
/* PR c/71924 - missing -Wreturn-local-addr returning alloca result
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
typedef __SIZE_TYPE__ size_t;

View file

@ -1,6 +1,7 @@
/* PR 90983/manual documents `-Wno-stack-usage` flag, but it is unrecognized
{ dg-do compile }
{ dg-options "-Wall -Wstack-usage=123 -Wno-stack-usage" } */
{ dg-options "-Wall -Wstack-usage=123 -Wno-stack-usage" }
{ dg-require-effective-target alloca } */
void f (void*);

View file

@ -4,7 +4,8 @@
for either kind of VLAs (member and non-member).
Diagnosing the accesses is the subject of pr82608.
{ dg-do compile }
{ dg-options "-O2 -Wall -Wno-array-bounds" } */
{ dg-options "-O2 -Wall -Wno-array-bounds" }
{ dg-require-effective-target alloca } */
void sink (void*);

View file

@ -4,7 +4,8 @@
warnings are issued for calls to user-defined functions with attribute
access and with non-constant out-of-bounds arguments.
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
#include "range.h"

View file

@ -1,6 +1,7 @@
/* PR middle-end/91582 - missing heap overflow detection for strcpy
{ dg-do compile }
{ dg-options "-O2 -Wall -Wno-array-bounds -ftrack-macro-expansion=0" } */
{ dg-options "-O2 -Wall -Wno-array-bounds -ftrack-macro-expansion=0" }
{ dg-require-effective-target alloca } */
#include "range.h"

View file

@ -2,7 +2,8 @@
PR middle-end/85484 - missing -Wstringop-overflow for strcpy with
a string of non-const length
{ dg-do compile }
{ dg-options "-O2 -Wall -Wno-array-bounds" } */
{ dg-options "-O2 -Wall -Wno-array-bounds" }
{ dg-require-effective-target alloca } */
typedef __SIZE_TYPE__ size_t;

View file

@ -1,7 +1,8 @@
/* PR middle-end/95667 - unintended warning for memset writing across multiple
members
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
extern void sink (void*);

View file

@ -1,3 +1,5 @@
/* { dg-require-effective-target alloca } */
#include <alloca.h>
void *test (void)

View file

@ -1,3 +1,5 @@
/* { dg-require-effective-target alloca } */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

View file

@ -1,3 +1,5 @@
/* { dg-require-effective-target label_values } */
/* Labels as values. */
#include "analyzer-decls.h"

View file

@ -1,3 +1,5 @@
/* { dg-require-effective-target alloca } */
#include <alloca.h>
#include <stdlib.h>

View file

@ -1,4 +1,5 @@
/* { dg-additional-options "-fanalyzer-transitivity" } */
/* { dg-require-effective-target alloca } */
#include <stddef.h>
#include <alloca.h>

View file

@ -1,4 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target label_values } */
void
ch (int x1)

View file

@ -1 +1,2 @@
/* { dg-require-effective-target indirect_jumps } */
#include "../pr26983.c"

View file

@ -1,5 +1,6 @@
/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
/* { dg-enable-nn-line-numbers "" } */
/* { dg-require-effective-target indirect_jumps } */
#include "test-setjmp.h"
#include <stddef.h>

View file

@ -1,5 +1,6 @@
/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
/* { dg-enable-nn-line-numbers "" } */
/* { dg-require-effective-target indirect_jumps } */
#include <stddef.h>
#include "test-setjmp.h"

View file

@ -1,5 +1,6 @@
/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
/* { dg-enable-nn-line-numbers "" } */
/* { dg-require-effective-target indirect_jumps } */
#include "test-setjmp.h"
#include "analyzer-decls.h"

View file

@ -1,5 +1,6 @@
/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
/* { dg-enable-nn-line-numbers "" } */
/* { dg-require-effective-target indirect_jumps } */
#include "test-setjmp.h"
#include <stddef.h>

View file

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_jumps } */
#include "test-setjmp.h"
#include <stddef.h>
#include <stdlib.h>

View file

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_jumps } */
#include "test-setjmp.h"
#include <stddef.h>
#include <stdlib.h>

View file

@ -1,5 +1,6 @@
/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
/* { dg-enable-nn-line-numbers "" } */
/* { dg-require-effective-target indirect_jumps } */
#include "test-setjmp.h"
#include <stdlib.h>

View file

@ -1,5 +1,6 @@
/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
/* { dg-enable-nn-line-numbers "" } */
/* { dg-require-effective-target indirect_jumps } */
#include "test-setjmp.h"
#include <stddef.h>

View file

@ -1,5 +1,6 @@
/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
/* { dg-enable-nn-line-numbers "" } */
/* { dg-require-effective-target indirect_jumps } */
#include "test-setjmp.h"
#include <stddef.h>

View file

@ -1,4 +1,5 @@
/* { dg-additional-options "-O1 -g" } */
/* { dg-require-effective-target indirect_jumps } */
#include <setjmp.h>

View file

@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fexceptions -fgimple -fdump-tree-eh-eh" } */
/* { dg-require-effective-target nonlocal_goto } */
void __GIMPLE foo()
{

View file

@ -1,7 +1,8 @@
/* PR 94131 - ICE on printf with a VLA string and -fno-tree-ccp
-fno-tree-forwprop
{ dg-do compile }
{ dg-options "-O1 -fno-tree-ccp -fno-tree-forwprop" } */
{ dg-options "-O1 -fno-tree-ccp -fno-tree-forwprop" }
{ dg-require-effective-target alloca } */
void rv1 (int n)
{

View file

@ -1,6 +1,7 @@
/* PR tree-optimization/93986 - ICE in decompose, at wide-int.h:984
{ dg-do compile }
{ dg-options "-O1 -foptimize-strlen -ftree-slp-vectorize" } */
{ dg-options "-O1 -foptimize-strlen -ftree-slp-vectorize" }
{ dg-require-effective-target alloca } */
int dd (void);

View file

@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3" } */
/* { dg-require-effective-target label_values } */
extern int a[16];
void f (int *ip, int x)

View file

@ -1,6 +1,7 @@
/* PR tree-optimization/95857 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target label_values } */
struct E { int e; };
int bar (void), baz (void);

View file

@ -1,7 +1,8 @@
/* PR tree-optimization/83821 - local aggregate initialization defeats
strlen optimization
{ dg-do compile }
{ dg-options "-O2 -Wall -fdump-tree-optimized" } */
{ dg-options "-O2 -Wall -fdump-tree-optimized" }
{ dg-require-effective-target alloca } */
#include "strlenopt.h"
char *p_p2, *p_p5, *p_p9, *p_p14;

View file

@ -3,7 +3,8 @@
Verify that stores that overwrite an interior nul are correctly
reflected in strlen results.
{ dg-do run }
{ dg-options "-O2 -Wall" } */
{ dg-options "-O2 -Wall" }
{ dg-require-effective-target alloca } */
#define false (0 == 1)
#define true (0 == 0)

View file

@ -1,7 +1,8 @@
/* PR tree-optimization/92412 - excessive errno aliasing assumption defeats
optimization
{ dg-do compile }
{ dg-options "-O2 -Wall -fdump-tree-optimized" } */
{ dg-options "-O2 -Wall -fdump-tree-optimized" }
{ dg-require-effective-target alloca } */
typedef __SIZE_TYPE__ size_t;

View file

@ -1,7 +1,8 @@
/* PR middle-end/10138 - warn for uninitialized arrays passed as const*
arguments
{ dg-do compile }
{ dg-options "-O -Wall" } */
{ dg-options "-O -Wall" }
{ dg-require-effective-target alloca } */
typedef __SIZE_TYPE__ size_t;

View file

@ -3,7 +3,8 @@
Verify that passing pointers to uninitialized objects to const
arguments to built-ins is diagnosed where expected.
{ dg-do compile }
{ dg-options "-O -Wall" } */
{ dg-options "-O -Wall" }
{ dg-require-effective-target alloca } */
typedef __SIZE_TYPE__ size_t;