diff options
Diffstat (limited to 'gcc/testsuite')
36 files changed, 914 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 330a283..5710dbe3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,73 @@ +2025-04-13 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/119502 + * gfortran.dg/pr119502.f90: New test. + +2025-04-13 Nathaniel Shead <nathanieloshead@gmail.com> + + * g++.dg/modules/noexcept-4_a.H: New test. + * g++.dg/modules/noexcept-4_b.C: New test. + +2025-04-13 Nathaniel Shead <nathanieloshead@gmail.com> + + * g++.dg/modules/lambda-8_b.C: Adjust error. + * g++.dg/modules/leg-merge-4_c.C: Likewise. + +2025-04-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/119669 + * gfortran.dg/interface_59.f90: New test. + +2025-04-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/119761 + * gdc.dg/import-c/import-c.exp: New test. + * gdc.dg/import-c/pr119761.d: New test. + * gdc.dg/import-c/pr119761c.c: New test. + +2025-04-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/109023 + * gdc.dg/torture/imports/pr109023.d: New test. + * gdc.dg/torture/pr109023.d: New test. + +2025-04-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/119758 + * gdc.dg/driver_fonly1.d: New test. + * gdc.dg/driver_fonly2.d: New test. + * gdc.dg/driver_fonly3.d: New test. + * gdc.dg/imports/fonly.d: New test. + +2025-04-12 Andrew Pinski <quic_apinski@quicinc.com> + + PR testsuite/117706 + * gcc.dg/ira-shrinkwrap-prep-1.c: Unxfail for i?68-*-* and x86_64-*-*. + * gcc.dg/ira-shrinkwrap-prep-2.c: Likewise. + +2025-04-12 Patrick Palka <ppalka@redhat.com> + + PR c++/116416 + * g++.dg/cpp1y/constexpr-prvalue1.C: Adjust to instead inspect + the 'original' dump. + * g++.dg/cpp1y/constexpr-prvalue1a.C: New test. + +2025-04-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119722 + * gcc.dg/torture/bitint-77.c: New test. + +2025-04-12 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/renaming17.adb: New test. + +2025-04-12 Bob Dubner <rdubner@symas.com> + + PR cobol/119694 + * cobol.dg/group2/ACCEPT_DATE___DAY_and_intrinsic_functions__2_.cob: GCOBOL_CURRENT_DATE. + * cobol.dg/group2/ACCEPT_FROM_TIME___DATE___DAY___DAY-OF-WEEK__2_.cob: Likewise + * cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob: Likewise + 2025-04-11 Christophe Lyon <christophe.lyon@linaro.org> * lib/target-supports.exp: Rename arm_v8_1_lob_ok into diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic20.C b/gcc/testsuite/g++.dg/concepts/diagnostic20.C new file mode 100644 index 0000000..2bb01db --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/diagnostic20.C @@ -0,0 +1,13 @@ +// PR c++/99214 +// { dg-do compile { target c++20 } } + +template <class T> +struct A { + template <class U> static void f() requires requires { T::fail; }; +}; + +int main() { + A<int>::f<char>(); // { dg-error "no match" } +} + +// { dg-message "In substitution of '\[^\r\n\]* \\\[with U = char\\\]'" "" { target *-*-* } 0 } diff --git a/gcc/testsuite/g++.dg/modules/lambda-8_b.C b/gcc/testsuite/g++.dg/modules/lambda-8_b.C index 7ace494..96578ba 100644 --- a/gcc/testsuite/g++.dg/modules/lambda-8_b.C +++ b/gcc/testsuite/g++.dg/modules/lambda-8_b.C @@ -4,4 +4,4 @@ #include "lambda-8.h" import "lambda-8_a.H"; -// { dg-error "conflicting global module declaration" "" { target *-*-* } 0 } +// { dg-error "conflicting imported declaration" "" { target *-*-* } 0 } diff --git a/gcc/testsuite/g++.dg/modules/leg-merge-4_c.C b/gcc/testsuite/g++.dg/modules/leg-merge-4_c.C index f1b1aeb..5756057 100644 --- a/gcc/testsuite/g++.dg/modules/leg-merge-4_c.C +++ b/gcc/testsuite/g++.dg/modules/leg-merge-4_c.C @@ -11,8 +11,8 @@ void foo () X *p; } -// { dg-regexp "\nIn module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:4:\[0-9]*: error: conflicting global module declaration 'float bob'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:4:\[0-9]*: note: existing declaration 'int bob'\n\[^\n]*leg-merge-4_c.C:9:\[0-9]*: note: during load of binding '::bob'$" } +// { dg-regexp "\nIn module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:4:\[0-9]*: error: conflicting type for imported declaration 'float bob'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:4:\[0-9]*: note: existing declaration 'int bob'\n\[^\n]*leg-merge-4_c.C:9:\[0-9]*: note: during load of binding '::bob'$" } -// { dg-regexp "\nIn module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:5:\[0-9]*: error: conflicting global module declaration 'int frob\\(\\)'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:5:\[0-9]*: note: existing declaration 'void frob\\(\\)'\n\[^\n]*leg-merge-4_c.C:10:\[0-9]*: note: during load of binding '::frob'$" } +// { dg-regexp "\nIn module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:5:\[0-9]*: error: conflicting type for imported declaration 'int frob\\(\\)'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:5:\[0-9]*: note: existing declaration 'void frob\\(\\)'\n\[^\n]*leg-merge-4_c.C:10:\[0-9]*: note: during load of binding '::frob'$" } -// { dg-regexp "In module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:6:\[0-9]*: error: conflicting global module declaration 'union X'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:6:\[0-9]*: note: existing declaration 'class X'\n\[^\n]*leg-merge-4_c.C:11:\[0-9]*: note: during load of binding '::X'$" } +// { dg-regexp "In module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:6:\[0-9]*: error: conflicting type for imported declaration 'union X'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:6:\[0-9]*: note: existing declaration 'class X'\n\[^\n]*leg-merge-4_c.C:11:\[0-9]*: note: during load of binding '::X'$" } diff --git a/gcc/testsuite/g++.dg/modules/noexcept-4_a.H b/gcc/testsuite/g++.dg/modules/noexcept-4_a.H new file mode 100644 index 0000000..b888a1b --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-4_a.H @@ -0,0 +1,6 @@ +// { dg-additional-options "-fmodule-header -std=c++20" } +// { dg-module-cmi {} } + +struct exception_ptr { + friend bool operator==(const exception_ptr&, const exception_ptr&) = default; +}; diff --git a/gcc/testsuite/g++.dg/modules/noexcept-4_b.C b/gcc/testsuite/g++.dg/modules/noexcept-4_b.C new file mode 100644 index 0000000..7cc5531 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-4_b.C @@ -0,0 +1,18 @@ +// { dg-additional-options "-fmodules -std=c++20" } + +struct exception_ptr { + friend bool operator==(const exception_ptr&, const exception_ptr&) = default; +}; + +void enqueue() { + exception_ptr e; + e == e; +} + +import "noexcept-4_a.H"; + +int main() { + constexpr exception_ptr e; + static_assert(e == e); + static_assert(noexcept(e == e)); +} diff --git a/gcc/testsuite/g++.dg/torture/pr119778.C b/gcc/testsuite/g++.dg/torture/pr119778.C new file mode 100644 index 0000000..4948056 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr119778.C @@ -0,0 +1,20 @@ +// { dg-do compile } +// { dg-additional-options "-Wall" } + +struct jmp_buf { long l[16]; }; +extern "C" int setjmp (jmp_buf *); +struct S { + void foo () { bar (); } + virtual char bar () { return 0; } +}; +void baz (); +jmp_buf *a; + +void +qux (bool x, S *y) +{ + if (x) + setjmp (a); + y->foo (); + baz (); +} diff --git a/gcc/testsuite/gcc.dg/ipa/pr119318.c b/gcc/testsuite/gcc.dg/ipa/pr119318.c new file mode 100644 index 0000000..8e62ec5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr119318.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int128 } */ +/* { dg-additional-options "-Wno-psabi -w" } */ +/* { dg-options "-Wno-psabi -O2" } */ + +typedef unsigned V __attribute__((vector_size (64))); +typedef unsigned __int128 W __attribute__((vector_size (64))); + +W a; +W b; +W c = { -0xffff, -0xffff, -0xffff, -0xffff }; + +static __attribute__((__noinline__, __noclone__)) W +bar (unsigned __int128 u) +{ + return u + c; +} + +static inline W +foo (unsigned short s, V v) +{ + V y = (V) bar ((unsigned short) ~s); + v >>= y; + b ^= (W) a; + v *= v; + return (W) v + b; +} + + +int +main () +{ + W x = foo (0, (V) { 0, 5 }); + for (unsigned i = 0; i < sizeof(x)/sizeof(x[0]); i++) + if (x[i] != (i ? 0 : 0x1900000000)) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/ipa/pr119530.c b/gcc/testsuite/gcc.dg/ipa/pr119530.c new file mode 100644 index 0000000..f99c4fd --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr119530.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-tree-vrp -fno-inline" } */ + +struct a { + int b; +}; +int c; +signed char d; +static int e(long long f) { return f < 0; } +static void g(unsigned f) { c = e(~f); } +int main() { + int h; + struct a i = {128}; + h = d > i.b; + g(h); + if (h) + __builtin_abort(); + if (c) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr118476-1.c b/gcc/testsuite/gcc.dg/torture/pr118476-1.c new file mode 100644 index 0000000..33509403 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr118476-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +/* PR tree-optimization/118476 */ + +typedef unsigned long long poly64x1 __attribute__((__vector_size__(1*sizeof(long long)))); + +poly64x1 vext_p64(poly64x1 a, poly64x1 b, const int n) +{ + poly64x1 r = a; + unsigned src = (unsigned)n; + long long t = b[0]; + r[0] = (src < 1) ? a[src] : t; + return r; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr119757.c b/gcc/testsuite/gcc.dg/vect/pr119757.c new file mode 100644 index 0000000..8644299 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr119757.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +void base64_encode(const char *table64, + const char *inputbuff, int insize, + char * __restrict output) +{ + const unsigned char *in = (const unsigned char *)inputbuff; + + while(insize >= 3) { + *output++ = table64[ in[0] >> 2 ]; + *output++ = table64[ ((in[0] & 0x03) << 4) | (in[1] >> 4) ]; + *output++ = table64[ ((in[1] & 0x0F) << 2) | ((in[2] & 0xC0) >> 6) ]; + *output++ = table64[ in[2] & 0x3F ]; + insize -= 3; + in += 3; + } +} diff --git a/gcc/testsuite/gcc.target/i386/pr119784a.c b/gcc/testsuite/gcc.target/i386/pr119784a.c new file mode 100644 index 0000000..8a119d4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119784a.c @@ -0,0 +1,96 @@ +/* { dg-do compile { target { *-*-linux* && lp64 } } } */ +/* { dg-options "-O2 -fno-pic -mtune=generic -mgeneral-regs-only -mapxf -mtune-ctrl=prologue_using_move,epilogue_using_move" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* start must save and restore all caller saved registers. */ + +/* +**start: +**.LFB[0-9]+: +** .cfi_startproc +** subq \$248, %rsp +**... +** movq %rax, \(%rsp\) +** movq %rdx, 8\(%rsp\) +** movq %rcx, 16\(%rsp\) +** movq %rbx, 24\(%rsp\) +** movq %rsi, 32\(%rsp\) +** movq %rdi, 40\(%rsp\) +**... +** movq %rbp, 48\(%rsp\) +** movq %r8, 56\(%rsp\) +** movq %r9, 64\(%rsp\) +** movq %r10, 72\(%rsp\) +** movq %r11, 80\(%rsp\) +** movq %r12, 88\(%rsp\) +** movq %r13, 96\(%rsp\) +** movq %r14, 104\(%rsp\) +** movq %r15, 112\(%rsp\) +** movq %r16, 120\(%rsp\) +** movq %r17, 128\(%rsp\) +** movq %r18, 136\(%rsp\) +** movq %r19, 144\(%rsp\) +** movq %r20, 152\(%rsp\) +** movq %r21, 160\(%rsp\) +** movq %r22, 168\(%rsp\) +** movq %r23, 176\(%rsp\) +** movq %r24, 184\(%rsp\) +** movq %r25, 192\(%rsp\) +** movq %r26, 200\(%rsp\) +** movq %r27, 208\(%rsp\) +** movq %r28, 216\(%rsp\) +** movq %r29, 224\(%rsp\) +** movq %r30, 232\(%rsp\) +** movq %r31, 240\(%rsp\) +**... +** call \*code\(%rip\) +** movq \(%rsp\), %rax +** movq 8\(%rsp\), %rdx +** movq 16\(%rsp\), %rcx +** movq 24\(%rsp\), %rbx +** movq 32\(%rsp\), %rsi +** movq 40\(%rsp\), %rdi +** movq 48\(%rsp\), %rbp +** movq 56\(%rsp\), %r8 +** movq 64\(%rsp\), %r9 +** movq 72\(%rsp\), %r10 +** movq 80\(%rsp\), %r11 +** movq 88\(%rsp\), %r12 +** movq 96\(%rsp\), %r13 +** movq 104\(%rsp\), %r14 +** movq 112\(%rsp\), %r15 +** movq 120\(%rsp\), %r16 +** movq 128\(%rsp\), %r17 +** movq 136\(%rsp\), %r18 +** movq 144\(%rsp\), %r19 +** movq 152\(%rsp\), %r20 +** movq 160\(%rsp\), %r21 +** movq 168\(%rsp\), %r22 +** movq 176\(%rsp\), %r23 +** movq 184\(%rsp\), %r24 +** movq 192\(%rsp\), %r25 +** movq 200\(%rsp\), %r26 +** movq 208\(%rsp\), %r27 +** movq 216\(%rsp\), %r28 +** movq 224\(%rsp\), %r29 +** movq 232\(%rsp\), %r30 +** movq 240\(%rsp\), %r31 +** addq \$248, %rsp +**... +** ret +** .cfi_endproc +**... +*/ + +#define DONT_SAVE_REGS __attribute__((no_callee_saved_registers)) +#define SAVE_REGS __attribute__((no_caller_saved_registers)) + +typedef DONT_SAVE_REGS void (*op_t)(void); + +extern op_t code[]; + +SAVE_REGS void start() +{ + code[0](); +} diff --git a/gcc/testsuite/gcc.target/i386/pr119784b.c b/gcc/testsuite/gcc.target/i386/pr119784b.c new file mode 100644 index 0000000..c676197 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119784b.c @@ -0,0 +1,87 @@ +/* { dg-do compile { target { *-*-linux* && x32 } } } */ +/* { dg-options "-O2 -fno-pic -mtune=generic -mgeneral-regs-only -mapxf -mtune-ctrl=prologue_using_move,epilogue_using_move" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* start must save and restore all caller saved registers. */ + +/* +**start: +**.LFB[0-9]+: +** .cfi_startproc +** subl \$248, %esp +**... +** movq %rax, \(%rsp\) +** movq %rdx, 8\(%rsp\) +** movq %rcx, 16\(%rsp\) +** movq %rbx, 24\(%rsp\) +** movq %rsi, 32\(%rsp\) +** movq %rdi, 40\(%rsp\) +**... +** movq %rbp, 48\(%rsp\) +** movq %r8, 56\(%rsp\) +** movq %r9, 64\(%rsp\) +** movq %r10, 72\(%rsp\) +** movq %r11, 80\(%rsp\) +** movq %r12, 88\(%rsp\) +** movq %r13, 96\(%rsp\) +** movq %r14, 104\(%rsp\) +** movq %r15, 112\(%rsp\) +** movq %r16, 120\(%rsp\) +** movq %r17, 128\(%rsp\) +** movq %r18, 136\(%rsp\) +** movq %r19, 144\(%rsp\) +** movq %r20, 152\(%rsp\) +** movq %r21, 160\(%rsp\) +** movq %r22, 168\(%rsp\) +** movq %r23, 176\(%rsp\) +** movq %r24, 184\(%rsp\) +** movq %r25, 192\(%rsp\) +** movq %r26, 200\(%rsp\) +** movq %r27, 208\(%rsp\) +** movq %r28, 216\(%rsp\) +** movq %r29, 224\(%rsp\) +** movq %r30, 232\(%rsp\) +** movq %r31, 240\(%rsp\) +**... +** movl code\(%rip\), %ebp +** call \*%rbp +** movq \(%rsp\), %rax +** movq 8\(%rsp\), %rdx +** movq 16\(%rsp\), %rcx +** movq 24\(%rsp\), %rbx +** movq 32\(%rsp\), %rsi +** movq 40\(%rsp\), %rdi +** movq 48\(%rsp\), %rbp +** movq 56\(%rsp\), %r8 +** movq 64\(%rsp\), %r9 +** movq 72\(%rsp\), %r10 +** movq 80\(%rsp\), %r11 +** movq 88\(%rsp\), %r12 +** movq 96\(%rsp\), %r13 +** movq 104\(%rsp\), %r14 +** movq 112\(%rsp\), %r15 +** movq 120\(%rsp\), %r16 +** movq 128\(%rsp\), %r17 +** movq 136\(%rsp\), %r18 +** movq 144\(%rsp\), %r19 +** movq 152\(%rsp\), %r20 +** movq 160\(%rsp\), %r21 +** movq 168\(%rsp\), %r22 +** movq 176\(%rsp\), %r23 +** movq 184\(%rsp\), %r24 +** movq 192\(%rsp\), %r25 +** movq 200\(%rsp\), %r26 +** movq 208\(%rsp\), %r27 +** movq 216\(%rsp\), %r28 +** movq 224\(%rsp\), %r29 +** movq 232\(%rsp\), %r30 +** movq 240\(%rsp\), %r31 +** addl \$248, %esp +**... +** ret +** .cfi_endproc +**... +*/ + +#include "pr119784a.c" diff --git a/gcc/testsuite/gdc.dg/import-c/import-c.exp b/gcc/testsuite/gdc.dg/import-c/import-c.exp new file mode 100644 index 0000000..53d1478 --- /dev/null +++ b/gcc/testsuite/gdc.dg/import-c/import-c.exp @@ -0,0 +1,29 @@ +# Copyright (C) 2025 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Load support procs. +load_lib gdc-dg.exp + +# Initialize `dg'. +dg-init + +# Main loop. +gdc-dg-runtest [lsort \ + [glob -nocomplain $srcdir/$subdir/*.d ] ] "" \ + "-I $srcdir/$subdir -finclude-imports" + +# All done. +dg-finish diff --git a/gcc/testsuite/gdc.dg/import-c/pr119761.d b/gcc/testsuite/gdc.dg/import-c/pr119761.d new file mode 100644 index 0000000..20eff31 --- /dev/null +++ b/gcc/testsuite/gdc.dg/import-c/pr119761.d @@ -0,0 +1,2 @@ +// { dg-do compile } +import pr119761c; diff --git a/gcc/testsuite/gdc.dg/import-c/pr119761c.c b/gcc/testsuite/gdc.dg/import-c/pr119761c.c new file mode 100644 index 0000000..522f1bf --- /dev/null +++ b/gcc/testsuite/gdc.dg/import-c/pr119761c.c @@ -0,0 +1,4 @@ +int f119761(const char *, ...) +{ + return 0; +} diff --git a/gcc/testsuite/gdc.dg/torture/imports/pr109023.d b/gcc/testsuite/gdc.dg/torture/imports/pr109023.d new file mode 100644 index 0000000..e85e0ed --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/imports/pr109023.d @@ -0,0 +1,3 @@ +module imports.pr109023; + +void f109023() { } diff --git a/gcc/testsuite/gdc.dg/torture/pr109023.d b/gcc/testsuite/gdc.dg/torture/pr109023.d new file mode 100644 index 0000000..3060446 --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/pr109023.d @@ -0,0 +1,6 @@ +// { dg-do "compile" } +// { dg-additional-options "-I[srcdir] -finclude-imports" } +// { dg-additional-files "imports/pr109023.d" } +// { dg-final { scan-assembler "_D7imports8pr1090237f109023FZv" } } +module pr109023; +import imports.pr109023; diff --git a/gcc/testsuite/gfortran.dg/interface_59.f90 b/gcc/testsuite/gfortran.dg/interface_59.f90 new file mode 100644 index 0000000..c9ccd67 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_59.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! PR fortran/119669 - this used to generate an ICE. + +program a + implicit real(a-h,o-z) + external abstract_caller, caller, func +! real func + call abstract_caller (caller, func, 1.5) + call abstract_caller (caller, func, 1.5) +end program a + +function func (x) + real func, x + func = x * x - 1. +end diff --git a/gcc/testsuite/gfortran.dg/pr119502.f90 b/gcc/testsuite/gfortran.dg/pr119502.f90 new file mode 100644 index 0000000..80d7c61 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr119502.f90 @@ -0,0 +1,15 @@ +! { dg-do run } + +! PR119502, negative unit numbers are not allowed without using NEWUNIT + +program foo + integer :: iun = -1 + integer :: ios + open (iun, iostat=ios) + if (ios == 0) stop 1 + write(iun,*, iostat=ios) "This is a test." + if (ios == 0) stop 2 + close (iun, iostat=ios) + if (ios == 0) stop 3 +end + diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/doc-examples-pass.exp b/gcc/testsuite/gm2.dg/doc/examples/pass/doc-examples-pass.exp new file mode 100644 index 0000000..0bfcea0 --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/doc-examples-pass.exp @@ -0,0 +1,18 @@ +# Compile tests, no torture testing. +# +# These tests should all pass. + +# Load support procs. +load_lib gm2-dg.exp + +gm2_init_pim4 $srcdir/$subdir + +# Initialize `dg'. +dg-init + +# Main loop. + +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] "" "" + +# All done. +dg-finish diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd.mod b/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd.mod new file mode 100644 index 0000000..84020a8 --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd.mod @@ -0,0 +1,32 @@ +(* { dg-do assemble { target { x86_64-*-* } } } *) +(* { dg-options "-g" } *) + +MODULE exampleadd ; + +FROM libc IMPORT printf, exit ; + + +PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ; +VAR + myout: CARDINAL ; +BEGIN + ASM VOLATILE ("movl %1,%%eax; addl %2,%%eax; movl %%eax,%0" + : "=rm" (myout) (* outputs *) + : "rm" (foo), "rm" (bar) (* inputs *) + : "eax") ; (* we trash *) + RETURN( myout ) +END Example ; + + +VAR + a, b, c: CARDINAL ; +BEGIN + a := 1 ; + b := 2 ; + c := Example (a, b) ; + IF c # 3 + THEN + printf ("Example procedure function failed to return 3, seen %d", c) ; + exit (1) + END +END exampleadd. diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd2.mod b/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd2.mod new file mode 100644 index 0000000..f25397f --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd2.mod @@ -0,0 +1,32 @@ +(* { dg-do assemble { target { x86_64-*-* } } } *) +(* { dg-options "-g" } *) + +MODULE exampleadd2 ; + +FROM libc IMPORT printf, exit ; + + +PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ; +VAR + myout: CARDINAL ; +BEGIN + ASM VOLATILE ( + "movl %[left],%%eax; addl %[right],%%eax; movl %%eax,%[output]" + : [output] "=rm" (myout) (* outputs *) + : [left] "rm" (foo), [right] "rm" (bar) (* inputs *) + : "eax") ; (* we trash *) + RETURN( myout ) +END Example ; + +VAR + a, b, c: CARDINAL ; +BEGIN + a := 1 ; + b := 2 ; + c := Example (a, b) ; + IF c # 3 + THEN + printf ("Example procedure function failed to return 3, seen %d", c) ; + exit (1) + END +END exampleadd2. diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/hello.mod b/gcc/testsuite/gm2.dg/doc/examples/pass/hello.mod new file mode 100644 index 0000000..f9770ec --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/hello.mod @@ -0,0 +1,10 @@ +(* { dg-do run } *) +(* { dg-options "-g -fno-scaffold-dynamic" } *) + +MODULE hello ; + +FROM libc IMPORT printf ; + +BEGIN + printf ("hello world\n") +END hello. diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/hellopim.mod b/gcc/testsuite/gm2.dg/doc/examples/pass/hellopim.mod new file mode 100644 index 0000000..b7876cd --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/hellopim.mod @@ -0,0 +1,10 @@ +(* { dg-do run } *) +(* { dg-options "-g -fno-scaffold-dynamic" } *) + +MODULE hellopim ; + +FROM StrIO IMPORT WriteString, WriteLn ; + +BEGIN + WriteString ("hello world") ; WriteLn +END hellopim. diff --git a/gcc/testsuite/gnat.dg/lto29.adb b/gcc/testsuite/gnat.dg/lto29.adb new file mode 100644 index 0000000..44f556f --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto29.adb @@ -0,0 +1,9 @@ +-- { dg-do run } +-- { dg-options "-O -flto" { target lto } } + +with Lto29_Pkg; + +procedure Lto29 is +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/lto29_pkg.ads b/gcc/testsuite/gnat.dg/lto29_pkg.ads new file mode 100644 index 0000000..6008dc5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto29_pkg.ads @@ -0,0 +1,15 @@ +with Ada.Strings.Bounded; + +package Lto29_Pkg is + + package M is new Ada.Strings.Bounded.Generic_Bounded_Length (10); + + type T is new M.Bounded_String; + + Null_T : constant T; + +private + + Null_T : constant T := To_Bounded_String (""); + +end Lto29_Pkg; diff --git a/gcc/testsuite/rust/compile/enum_discriminant2.rs b/gcc/testsuite/rust/compile/enum_discriminant2.rs new file mode 100644 index 0000000..351dfbb --- /dev/null +++ b/gcc/testsuite/rust/compile/enum_discriminant2.rs @@ -0,0 +1,9 @@ +fn test() -> isize { + 1 +} + +enum Foo { + Bar = test() // { dg-error "only functions marked as .const." } +} + +fn main() {} diff --git a/gcc/testsuite/rust/compile/format_args_extra_comma.rs b/gcc/testsuite/rust/compile/format_args_extra_comma.rs new file mode 100644 index 0000000..fcc435c --- /dev/null +++ b/gcc/testsuite/rust/compile/format_args_extra_comma.rs @@ -0,0 +1,47 @@ +#![feature(rustc_attrs)] + +#[rustc_builtin_macro] +macro_rules! format_args { + () => {}; +} + +#[lang = "sized"] +trait Sized {} + +pub mod core { + pub mod fmt { + pub struct Formatter; + pub struct Result; + + pub struct Arguments<'a>; + + impl<'a> Arguments<'a> { + pub fn new_v1(_: &'a [&'static str], _: &'a [ArgumentV1<'a>]) -> Arguments<'a> { + Arguments + } + } + + pub struct ArgumentV1<'a>; + + impl<'a> ArgumentV1<'a> { + pub fn new<'b, T>(_: &'b T, _: fn(&T, &mut Formatter) -> Result) -> ArgumentV1 { + ArgumentV1 + } + } + + pub trait Display { + fn fmt(&self, _: &mut Formatter) -> Result; + } + + impl Display for i32 { + fn fmt(&self, _: &mut Formatter) -> Result { + // { dg-warning "unused name .self." "" { target *-*-* } .-1 } + Result + } + } + } +} + +fn main() { + let _formatted = format_args!("extra commas {} {}", 15, 14,); +} diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3693.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3693.rs new file mode 100644 index 0000000..e990c8b --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3693.rs @@ -0,0 +1,10 @@ +macro_rules! generate_pattern_iterators { + { + $(#[$forward_iterator_attribute:meta])* + } => { + } +} + +generate_pattern_iterators! { + /// Created with the method [`split`]. +} diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs new file mode 100644 index 0000000..e5b38bb --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs @@ -0,0 +1,80 @@ +// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } + +macro_rules! impl_fn_for_zst { + ($( + $( #[$attr: meta] )* + struct $Name: ident impl$( <$( $lifetime : lifetime ),+> )? Fn = + |$( $arg: ident: $ArgTy: ty ),*| -> $ReturnTy: ty + $body: block; + )+) => { + $( + $( #[$attr] )* + struct $Name; + + impl $( <$( $lifetime ),+> )? Fn<($( $ArgTy, )*)> for $Name { + #[inline] + extern "rust-call" fn call(&self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { + $body + } + } + + impl $( <$( $lifetime ),+> )? FnMut<($( $ArgTy, )*)> for $Name { + #[inline] + extern "rust-call" fn call_mut( + &mut self, + ($( $arg, )*): ($( $ArgTy, )*) + ) -> $ReturnTy { + Fn::call(&*self, ($( $arg, )*)) + } + } + + impl $( <$( $lifetime ),+> )? FnOnce<($( $ArgTy, )*)> for $Name { + type Output = $ReturnTy; + + #[inline] + extern "rust-call" fn call_once(self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { + Fn::call(&self, ($( $arg, )*)) + } + } + )+ + } +} + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +#[lang = "fn"] +pub trait Fn<Args>: FnMut<Args> { + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call(&self, args: Args) -> Self::Output; +} + +#[lang = "fn_mut"] +#[must_use = "closures are lazy and do nothing unless called"] +pub trait FnMut<Args>: FnOnce<Args> { + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; +} + +#[lang = "fn_once"] +pub trait FnOnce<Args> { + /// The returned type after the call operator is used. + #[lang = "fn_once_output"] + #[stable(feature = "fn_once_output", since = "1.12.0")] + type Output; + + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +impl_fn_for_zst! { + #[derive(Copy)] + struct LinesAnyMap impl<'a> Fn = |line: &'a str| -> () { + }; +} diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-1.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-1.rs new file mode 100644 index 0000000..6fc3a31 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-1.rs @@ -0,0 +1,10 @@ +macro_rules! doc_comment { + (#[ $attr: meta ]) => { + #[$attr] + struct Generated; // { dg-warning "never constructed" } + }; +} + +doc_comment! { + /// This is a generated struct +} diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs new file mode 100644 index 0000000..cfc8ab4 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs @@ -0,0 +1,81 @@ +// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } + +macro_rules! impl_fn_for_zst { + ($( + $( #[$attr: meta] )* + struct $Name: ident impl$( <$( $lifetime : lifetime ),+> )? Fn = + |$( $arg: ident: $ArgTy: ty ),*| -> $ReturnTy: ty + $body: block; + )+) => { + $( + $( #[$attr] )* + struct $Name; + + impl $( <$( $lifetime ),+> )? Fn<($( $ArgTy, )*)> for $Name { + #[inline] + extern "rust-call" fn call(&self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { + $body + } + } + + impl $( <$( $lifetime ),+> )? FnMut<($( $ArgTy, )*)> for $Name { + #[inline] + extern "rust-call" fn call_mut( + &mut self, + ($( $arg, )*): ($( $ArgTy, )*) + ) -> $ReturnTy { + Fn::call(&*self, ($( $arg, )*)) + } + } + + impl $( <$( $lifetime ),+> )? FnOnce<($( $ArgTy, )*)> for $Name { + type Output = $ReturnTy; + + #[inline] + extern "rust-call" fn call_once(self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { + Fn::call(&self, ($( $arg, )*)) + } + } + )+ + } +} + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +#[lang = "fn"] +pub trait Fn<Args>: FnMut<Args> { + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call(&self, args: Args) -> Self::Output; +} + +#[lang = "fn_mut"] +#[must_use = "closures are lazy and do nothing unless called"] +pub trait FnMut<Args>: FnOnce<Args> { + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; +} + +#[lang = "fn_once"] +pub trait FnOnce<Args> { + /// The returned type after the call operator is used. + #[lang = "fn_once_output"] + #[stable(feature = "fn_once_output", since = "1.12.0")] + type Output; + + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +impl_fn_for_zst! { + /// Documentation for the zst + #[derive(Copy)] + struct LinesAnyMap impl<'a> Fn = |line: &'a str| -> () { + }; +} diff --git a/gcc/testsuite/rust/compile/track_caller.rs b/gcc/testsuite/rust/compile/track_caller.rs new file mode 100644 index 0000000..fd1d842 --- /dev/null +++ b/gcc/testsuite/rust/compile/track_caller.rs @@ -0,0 +1,6 @@ +#[track_caller] +fn foo() {} + +fn main() { + foo(); +} diff --git a/gcc/testsuite/rust/execute/torture/min_specialization2.rs b/gcc/testsuite/rust/execute/torture/min_specialization2.rs new file mode 100644 index 0000000..d3239ee --- /dev/null +++ b/gcc/testsuite/rust/execute/torture/min_specialization2.rs @@ -0,0 +1,31 @@ +#![feature(min_specialization)] + +#[lang = "sized"] +trait Sized {} + +trait Foo { + fn foo(&self) -> i32; +} + +impl<T> Foo for T { + default fn foo(&self) -> i32 { // { dg-warning "unused" } + 15 + } +} + +impl Foo for bool { + fn foo(&self) -> i32 { + if *self { + 1 + } else { + 0 + } + } +} + +fn main() -> i32 { + let a = 1.foo() - 15; + let b = true.foo() - 1; + + a + b +} diff --git a/gcc/testsuite/rust/execute/torture/min_specialization3.rs b/gcc/testsuite/rust/execute/torture/min_specialization3.rs new file mode 100644 index 0000000..9eccd97 --- /dev/null +++ b/gcc/testsuite/rust/execute/torture/min_specialization3.rs @@ -0,0 +1,36 @@ +#![feature(min_specialization)] + +#[lang = "sized"] +trait Sized {} + +trait Foo { + fn foo(&self) -> i32; +} + +struct Wrap<T>(T); + +impl<T> Foo for T { + default fn foo(&self) -> i32 { + 15 + } +} + +impl<T> Foo for Wrap<T> { + default fn foo(&self) -> i32 { + 16 + } +} + +impl Foo for Wrap<bool> { + fn foo(&self) -> i32 { + if self.0 { + 1 + } else { + 0 + } + } +} + +fn main() -> i32 { + Wrap(true).foo() - 1 +} |