When compiling builtin-object-size-21.c for nvptx, cc1 times out while
emitting the initializer for global variable xm3_3.
With x86_64, we are able to emit the initializer with a few lines of assembly:
...
xm3_3:
.byte 0
.zero
9223372036854775803
.byte 1
.byte 2
.byte 3
...
but with nvptx, we don't have some something similar available, and thus
generate:
...
.visible .global .align 1 .u32 xm3_3[
2305843009213693952] =
{ 0, 0, 0, ...
...
Introduce an effective target large_initializer, returning false for nvptx,
and require it for test-cases with large initializers.
Tested on nvptx with make check-gcc.
gcc/testsuite/ChangeLog:
PR testsuite/96566
* lib/target-supports.exp (check_effective_target_large_initializer):
New proc.
* gcc.dg/builtin-object-size-21.c: Require large_initializer.
* gcc.dg/strlenopt-55.c: Same.
/* PR middle-end/92815 - spurious -Wstringop-overflow writing into
a flexible array of an extern struct
{ dg-do compile }
- { dg-options "-Wall -fdump-tree-optimized" } */
+ { dg-options "-Wall -fdump-tree-optimized" }
+ { dg-require-effective-target large_initializer } */
#define PTRDIFF_MAX __PTRDIFF_MAX__
Verify that strlen() of braced initialized array is folded
{ dg-do compile }
- { dg-options "-O1 -Wall -fdump-tree-gimple -fdump-tree-optimized" } */
+ { dg-options "-O1 -Wall -fdump-tree-gimple -fdump-tree-optimized" }
+ { dg-require-effective-target large_initializer } */
#include "strlenopt.h"
#endif
} ""]
}
+
+# Return 1 if the target has an efficient means to encode large initializers
+# in the assembly.
+
+proc check_effective_target_large_initializer { } {
+ if { [istarget nvptx*-*-*] } {
+ return 0
+ }
+
+ return 1
+}