testsuite: new require effective target indirect_calls

This patch adds a new dg_require_effective_target procedure to the
testsuite infrastructure: indirect_calls.  This new function tells
whether a target supports calls to non-constant call targets.
    
This patch also annotates the tests in the gcc.c-torture testuite that
require support for indirect calls.
    
    gcc/ChangeLog:
    
            * doc/sourcebuild.texi (Effective-Target Keywords): Document
            indirect_calls.
    
    gcc/testsuite/ChangeLog:
    
            * lib/target-supports.exp (check_effective_target_indirect_calls):
            New proc.
            * gcc.c-torture/compile/20010102-1.c: Annotate with
            dg-require-effective-target indirect_calls.
            * gcc.c-torture/compile/20010107-1.c: Likewise.
            * gcc.c-torture/compile/20011109-1.c: Likewise.
            * gcc.c-torture/compile/20011218-1.c: Likewise.
            * gcc.c-torture/compile/20011229-1.c: Likewise.
            * gcc.c-torture/compile/20020129-1.c: Likewise.
            * gcc.c-torture/compile/20020320-1.c: Likewise.
            * gcc.c-torture/compile/20020706-1.c: Likewise.
            * gcc.c-torture/compile/20020706-2.c: Likewise.
            * gcc.c-torture/compile/20021205-1.c: Likewise.
            * gcc.c-torture/compile/20030921-1.c: Likewise.
            * gcc.c-torture/compile/20031023-1.c: Likewise.
            * gcc.c-torture/compile/20031023-2.c: Likewise.
            * gcc.c-torture/compile/20031023-3.c: Likewise.
            * gcc.c-torture/compile/20031023-4.c: Likewise.
            * gcc.c-torture/compile/20040614-1.c: Likewise.
            * gcc.c-torture/compile/20040909-1.c: Likewise.
            * gcc.c-torture/compile/20050122-1.c: Likewise.
            * gcc.c-torture/compile/20050202-1.c: Likewise.
            * gcc.c-torture/compile/20060208-1.c: Likewise.
            * gcc.c-torture/compile/20081108-1.c: Likewise.
            * gcc.c-torture/compile/20150327.c: Likewise.
            * gcc.c-torture/compile/920428-2.c: Likewise.
            * gcc.c-torture/compile/920928-5.c: Likewise.
            * gcc.c-torture/compile/930117-1.c: Likewise.
            * gcc.c-torture/compile/930607-1.c: Likewise.
            * gcc.c-torture/compile/991213-2.c: Likewise.
            * gcc.c-torture/compile/callind.c: Likewise.
            * gcc.c-torture/compile/calls-void.c: Likewise.
            * gcc.c-torture/compile/calls.c: Likewise.
            * gcc.c-torture/compile/pr21840.c: Likewise.
            * gcc.c-torture/compile/pr32139.c: Likewise.
            * gcc.c-torture/compile/pr35607.c: Likewise.
            * gcc.c-torture/compile/pr37433-1.c: Likewise.
            * gcc.c-torture/compile/pr37433.c: Likewise.
            * gcc.c-torture/compile/pr39941.c: Likewise.
            * gcc.c-torture/compile/pr40080.c: Likewise.
            * gcc.c-torture/compile/pr43635.c: Likewise.
            * gcc.c-torture/compile/pr43791.c: Likewise.
            * gcc.c-torture/compile/pr43845.c: Likewise.
            * gcc.c-torture/compile/pr44043.c: Likewise.
            * gcc.c-torture/compile/pr51694.c: Likewise.
            * gcc.c-torture/compile/pr77754-2.c: Likewise.
            * gcc.c-torture/compile/pr77754-3.c: Likewise.
            * gcc.c-torture/compile/pr77754-4.c: Likewise.
            * gcc.c-torture/compile/pr89663-2.c: Likewise.
            * gcc.c-torture/compile/pta-1.c: Likewise.
            * gcc.c-torture/compile/stack-check-1.c: Likewise.
            * gcc.dg/Walloc-size-larger-than-18.c: Likewise.

From-SVN: r275505
This commit is contained in:
Jose E. Marchesi 2019-09-09 11:55:10 +02:00 committed by Jose E. Marchesi
parent e9b8025bb0
commit a5362c6aea
53 changed files with 162 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
* doc/sourcebuild.texi (Effective-Target Keywords): Document
indirect_calls.
2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
* opt-functions.awk (integer_range_info): Make sure values are in

View File

@ -2374,6 +2374,10 @@ Target supports @code{wchar_t} that is compatible with @code{char32_t}.
@item comdat_group
Target uses comdat groups.
@item indirect_calls
Target supports indirect calls, i.e. calls where the target is not
constant.
@end table
@subsubsection Local to tests in @code{gcc.target/i386}

View File

@ -1,3 +1,58 @@
2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
* lib/target-supports.exp (check_effective_target_indirect_calls):
New proc.
* gcc.c-torture/compile/20010102-1.c: Annotate with
dg-require-effective-target indirect_calls.
* gcc.c-torture/compile/20010107-1.c: Likewise.
* gcc.c-torture/compile/20011109-1.c: Likewise.
* gcc.c-torture/compile/20011218-1.c: Likewise.
* gcc.c-torture/compile/20011229-1.c: Likewise.
* gcc.c-torture/compile/20020129-1.c: Likewise.
* gcc.c-torture/compile/20020320-1.c: Likewise.
* gcc.c-torture/compile/20020706-1.c: Likewise.
* gcc.c-torture/compile/20020706-2.c: Likewise.
* gcc.c-torture/compile/20021205-1.c: Likewise.
* gcc.c-torture/compile/20030921-1.c: Likewise.
* gcc.c-torture/compile/20031023-1.c: Likewise.
* gcc.c-torture/compile/20031023-2.c: Likewise.
* gcc.c-torture/compile/20031023-3.c: Likewise.
* gcc.c-torture/compile/20031023-4.c: Likewise.
* gcc.c-torture/compile/20040614-1.c: Likewise.
* gcc.c-torture/compile/20040909-1.c: Likewise.
* gcc.c-torture/compile/20050122-1.c: Likewise.
* gcc.c-torture/compile/20050202-1.c: Likewise.
* gcc.c-torture/compile/20060208-1.c: Likewise.
* gcc.c-torture/compile/20081108-1.c: Likewise.
* gcc.c-torture/compile/20150327.c: Likewise.
* gcc.c-torture/compile/920428-2.c: Likewise.
* gcc.c-torture/compile/920928-5.c: Likewise.
* gcc.c-torture/compile/930117-1.c: Likewise.
* gcc.c-torture/compile/930607-1.c: Likewise.
* gcc.c-torture/compile/991213-2.c: Likewise.
* gcc.c-torture/compile/callind.c: Likewise.
* gcc.c-torture/compile/calls-void.c: Likewise.
* gcc.c-torture/compile/calls.c: Likewise.
* gcc.c-torture/compile/pr21840.c: Likewise.
* gcc.c-torture/compile/pr32139.c: Likewise.
* gcc.c-torture/compile/pr35607.c: Likewise.
* gcc.c-torture/compile/pr37433-1.c: Likewise.
* gcc.c-torture/compile/pr37433.c: Likewise.
* gcc.c-torture/compile/pr39941.c: Likewise.
* gcc.c-torture/compile/pr40080.c: Likewise.
* gcc.c-torture/compile/pr43635.c: Likewise.
* gcc.c-torture/compile/pr43791.c: Likewise.
* gcc.c-torture/compile/pr43845.c: Likewise.
* gcc.c-torture/compile/pr44043.c: Likewise.
* gcc.c-torture/compile/pr51694.c: Likewise.
* gcc.c-torture/compile/pr77754-2.c: Likewise.
* gcc.c-torture/compile/pr77754-3.c: Likewise.
* gcc.c-torture/compile/pr77754-4.c: Likewise.
* gcc.c-torture/compile/pr89663-2.c: Likewise.
* gcc.c-torture/compile/pta-1.c: Likewise.
* gcc.c-torture/compile/stack-check-1.c: Likewise.
* gcc.dg/Walloc-size-larger-than-18.c: Likewise.
2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
* gcc.c-torture/compile/20000609-1.c: Annotate with

View File

@ -4,6 +4,8 @@
Copyright (C) 2001 Free Software Foundation. */
/* { dg-require-effective-target indirect_calls } */
# define PTR_INT_TYPE __PTRDIFF_TYPE__
struct _obstack_chunk

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
unsigned long x[4];
void foo(void)

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
typedef struct { short x[4]; } S;
typedef struct { unsigned int a, b, c; S *d; } T;

View File

@ -2,6 +2,8 @@
for the indirect call was exposed too early and reload couldn't
allocate it for multiplication and division. */
/* { dg-require-effective-target indirect_calls } */
struct S {
int a, b;
void (*f) (long, int);

View File

@ -1,5 +1,8 @@
/* ICE: call insn does not satisfy its constraints, MMIX port.
Origin: ghostscript-6.52, reduction from hp@bitrange.com. */
/* { dg-require-effective-target indirect_calls } */
struct s0
{
void (*init_color)(void *, void *);

View File

@ -1,5 +1,7 @@
/* Test call to static variable. */
/* { dg-require-effective-target indirect_calls } */
typedef struct
{
long long a[10];

View File

@ -2,6 +2,8 @@
This testcase caused infinite loop in flow (several places),
because flow assumes gen_jump generates simple_jump_p. */
/* { dg-require-effective-target indirect_calls } */
typedef void (*T) (void);
extern T x[];

View File

@ -1,6 +1,8 @@
// Contributed by Alexandre Oliva <aoliva@redhat.com>
// From Red Hat case 106165.
/* { dg-require-effective-target indirect_calls } */
typedef struct s1
{
unsigned short v1;

View File

@ -1,6 +1,8 @@
// Contributed by Alexandre Oliva <aoliva@redhat.com>
// From Red Hat case 106165.
/* { dg-require-effective-target indirect_calls } */
typedef unsigned short (FUNC_P) (void *, unsigned char *, unsigned short);
void crashIt(int id, FUNC_P *func, unsigned char *funcparm)

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
typedef struct x x;
extern void *baz(char *);
struct x { char * (*bar) (int); };

View File

@ -2,6 +2,7 @@
f is not being emitted. TREE_SYMBOL_REFERENCED was being set
instead of calling mark_referenced. */
/* { dg-require-effective-target indirect_calls } */
static void f(void);
void g(void (*x) (void)){x();}

View File

@ -1,5 +1,7 @@
/* Declaration of the frame size doesn't work on ptx. */
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-effective-target indirect_calls } */
#ifndef ASIZE
# define ASIZE 0x10000000000UL
#endif

View File

@ -1,4 +1,6 @@
/* Declaration of the frame size doesn't work on ptx. */
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-effective-target indirect_calls } */
#define ASIZE 0x1000000000UL
#include "20031023-1.c"

View File

@ -1,4 +1,6 @@
/* Declaration of the frame size doesn't work on ptx. */
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-effective-target indirect_calls } */
#define ASIZE 0x100000000UL
#include "20031023-1.c"

View File

@ -1,2 +1,4 @@
/* { dg-require-effective-target indirect_calls } */
#define ASIZE 0x80000000UL
#include "20031023-1.c"

View File

@ -1,4 +1,5 @@
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target indirect_calls } */
void f(int r1, int *fp)
{

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
static __inline__ int
one_utf8_to_utf16 () { }

View File

@ -1,4 +1,6 @@
/* From PR 19484. */
/* { dg-require-effective-target indirect_calls } */
extern void foo (void) __attribute__((noreturn));
int n;

View File

@ -1,4 +1,6 @@
/* From PR 19578. */
/* { dg-require-effective-target indirect_calls } */
extern void foo (void) __attribute__((noreturn));
void

View File

@ -1,5 +1,7 @@
/* PR middle-end/26092 */
/* { dg-require-effective-target indirect_calls } */
/* { dg-skip-if "can't take address of malloc" { nvptx-*-* } } */
typedef __SIZE_TYPE__ size_t;
extern void *malloc (size_t);

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
/* Test function call with function designator involving VLA
side-effects does not lead to an ICE. */

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
int a;
int (*b)(), (*c)();
int fn1(int p1) {

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
double sin(double x);
double cos(double x);
double tan(double x);

View File

@ -1,4 +1,7 @@
/* REPRODUCED:CC1:SIGNAL MACHINE:m68k OPTIONS:-fpcc-struct-return */
/* { dg-require-effective-target indirect_calls } */
struct b{};
f(struct b(*f)())
{

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
f(x)
{
(*(void (*)())&x)();

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
typedef void f ();
typedef f *pf;
long long i;

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
typedef long __kernel_time_t;
typedef __kernel_time_t time_t;
time2(

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
bar (foo, a)
int (**foo) ();
{

View File

@ -1,5 +1,6 @@
/* { dg-require-effective-target ptr32plus } */
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-effective-target indirect_calls } */
typedef void (*T)(void);
f1 ()

View File

@ -1,5 +1,6 @@
/* { dg-require-effective-target ptr32plus } */
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-effective-target indirect_calls } */
typedef void *(*T)(void);
f1 ()

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
void fn_show_state(void);
typedef void (*fn_handler_fn)(void);
static fn_handler_fn fn_handler[1];

View File

@ -1,4 +1,6 @@
/* PR tree-optimization/32139 */
/* { dg-require-effective-target indirect_calls } */
int foo (void);
int bar (void) __attribute__ ((const));

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
extern void (*__fini_array_start []) (void);
extern void (*__fini_array_end []) (void);
void

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
void regex_subst(void)
{
const void *subst = "";

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
int regex_subst(void)
{
const void *subst = "";

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
typedef void (*entry_func) (void) __attribute__ ((noreturn));
extern entry_func entry_addr;
static void bsd_boot_entry (void)

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
extern void *ff(void*,int);
struct lpgl { struct lpgl *next; };

View File

@ -1,4 +1,6 @@
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-effective-target indirect_calls } */
extern void d (void);
void (*foo (void)) (float)

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
int owner();
int clear();

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
typedef int __attribute__ ((const)) (*x264_pixel_cmp_t)(void);
typedef struct {

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
typedef unsigned char __u8;
typedef unsigned short __u16;
typedef unsigned int __u32;

View File

@ -1,4 +1,6 @@
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-effective-target indirect_calls } */
void
foo (x, fn)
void (*fn) ();

View File

@ -1,4 +1,5 @@
// { dg-require-effective-target alloca }
// { dg-require-effective-target indirect_calls }
/* PR c/77754 */
int fn3();

View File

@ -1,4 +1,5 @@
// { dg-require-effective-target alloca }
// { dg-require-effective-target indirect_calls }
/* PR c/77754 */
int fn3();

View File

@ -1,4 +1,5 @@
// { dg-require-effective-target alloca }
// { dg-require-effective-target indirect_calls }
/* PR c/77754 */
int fn3();

View File

@ -1,4 +1,5 @@
/* PR middle-end/89663 */
/* { dg-require-effective-target indirect_calls } */
int irint (double);
long lrint (double);

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target indirect_calls } */
typedef struct JSObject JSObject;
typedef struct JSObjectMap *(*JSNewObjectMapOp) (JSObject *obj);
typedef JSObject *(*JSGetMethodOp) (JSObject *obj);

View File

@ -1,3 +1,4 @@
/* { dg-require-effective-target indirect_calls } */
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-stack-check "" } */
/* { dg-additional-options "-fstack-check" } */

View File

@ -4,6 +4,7 @@
with zero or excessive size trigger either -Walloc-zero or
-Walloc-size-larger-than warnings.
{ dg-do compile }
{ dg-require-effective-target indirect_calls }
{ dg-options "-O2 -Wall -Walloc-zero -ftrack-macro-expansion=0" } */
#define ATTR(...) __attribute__ ((__VA_ARGS__))

View File

@ -9502,3 +9502,11 @@ proc check_effective_target_mfentry { } {
void foo (void) { }
} "-mfentry"]
}
# Return 1 if this target supports indirect calls
proc check_effective_target_indirect_calls { } {
if { [istarget bpf-*-*] } {
return 0
}
return 1
}