diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/debug | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/debug')
127 files changed, 3297 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/debug/20000503-1.c b/gcc/testsuite/gcc.dg/debug/20000503-1.c new file mode 100644 index 000000000..27d3c55dd --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20000503-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +/* Distilled from GCC's stmt.c. Caused abort in dwarf-1 code. */ + +static void +expand_nl_goto_receiver () +{ +{ +static struct elims {int from, to;} elim_regs[] = {{ 16, 7}, { 16, 6}, { 20, 7},{ 20, 6}}; + int i; + + for (i = 0; i < sizeof elim_regs / sizeof elim_regs[0]; i++) + if (elim_regs[i].from == 16 && elim_regs[i].to == 6) + break; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/20010207-1.c b/gcc/testsuite/gcc.dg/debug/20010207-1.c new file mode 100644 index 000000000..513d7a433 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20010207-1.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +extern inline int f1 (void) {return f2();} +int f3 (void) {return f1();} +int f1 (void) {return 0;} diff --git a/gcc/testsuite/gcc.dg/debug/20011223-1.c b/gcc/testsuite/gcc.dg/debug/20011223-1.c new file mode 100644 index 000000000..f8d70abce --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20011223-1.c @@ -0,0 +1,11 @@ +/* Origin: PR c/5163 from aj@suse.de. */ +/* { dg-do compile } */ + +extern int bar (int); + +int +foo (void) +{ + extern int bar (int); + return bar (5); +} diff --git a/gcc/testsuite/gcc.dg/debug/20020104-2.c b/gcc/testsuite/gcc.dg/debug/20020104-2.c new file mode 100644 index 000000000..854d17448 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20020104-2.c @@ -0,0 +1,9 @@ +/* This testcase used to fail because outlining_inline_function was called + too early, before rtl was generated. */ +/* { dg-do compile } */ + +int foo (const int *x) +{ + char a[*x]; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/20020220-1.c b/gcc/testsuite/gcc.dg/debug/20020220-1.c new file mode 100644 index 000000000..07109e86a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20020220-1.c @@ -0,0 +1,31 @@ +/* PR debug/4461 + This testcase failed to link in Dwarf-2 because + constant -4.0 in constant pool was never referenced by anything + but Dwarf-2 location descriptor. */ +/* { dg-do run } */ + +void __attribute__((noinline)) +foo (const char *x __attribute__((unused)), + __complex__ long double y __attribute__((unused)), + __complex__ long double z __attribute__((unused))) +{ +} + +void +bar (void) +{ + foo ("", + __builtin_conjl (({ __complex__ long double r; + __real__ r = 3.0; + __imag__ r = -4.0; + r; })), + ({ __complex__ long double s; + __real__ s = 3.0; + __imag__ s = 4.0; + s; })); +} + +int main (void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/20020224-1.c b/gcc/testsuite/gcc.dg/debug/20020224-1.c new file mode 100644 index 000000000..968b5655b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20020224-1.c @@ -0,0 +1,71 @@ +/* { dg-options "-g3 -O" } */ +/* { dg-do compile } */ + +/* Here's the deal: f4 is inlined into main, f3 is inlined into f4, f2 is + inlined into f1. The DIE of main should contain DW_TAG_inlined_subroutines + children for f4, f3, f2 and f1. Also, there should be a DIE representing + and out of line instance of f4, aside the DIE representing its abstract + instance. + We used to fail to emit debugging info for t1, because it was moved + inside the (inlined) block of f1, marked as abstract, then we'd crash. */ + +#define UNUSED __attribute__((unused)) +#define EXT __extension__ + +int undef(void); + +inline static void +f1 (int i UNUSED) +{ +} + +inline static void +f2 (void) +{ + f1 (EXT ({ int t1 UNUSED; undef (); })); +} + +inline static void +f3 (void) +{ + int v1 UNUSED; + int v2 UNUSED; + + EXT ({ int t2 UNUSED; if (0) undef (); 0; }) + && EXT ({ int t3 UNUSED; if (0) undef (); 0; }); + + if (1) + { + undef (); + if (1) + f2 (); + } + + { + undef (); + } +} + +inline static void +f4 (void) +{ + EXT ({ undef (); 1; }) && EXT ({ int t4 UNUSED = ({ 1; }); 1; }); + + { } + + EXT ({ int t5 UNUSED; if (0) undef (); 0; }); + + f4 (); + + undef (); + f3 (); + + return; +} + +int +main () +{ + int foo = 1; + f4 (); +} diff --git a/gcc/testsuite/gcc.dg/debug/20020327-1.c b/gcc/testsuite/gcc.dg/debug/20020327-1.c new file mode 100644 index 000000000..49d00a16c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20020327-1.c @@ -0,0 +1,12 @@ +/* { dg-do link } */ + +#ifndef __powerpc64__ +/* Fails on powerpc64-linux due to the function Letext using a global + .Letext symbol that conflicts with .Letext emitted by gcc with + -gstabs. Some day the linker will be fixed to not require global + "dot" syms, but for now disable this test entirely for powerpc64. + Using xfail doesn't work, nor does dg-excess-errors because some + combinations of command line options won't cause this test to fail. */ +void Letext (void) { } +#endif +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/debug/20030605-1.c b/gcc/testsuite/gcc.dg/debug/20030605-1.c new file mode 100644 index 000000000..548faaf5a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20030605-1.c @@ -0,0 +1,7 @@ +/* Verify we don't ICE on statement-expressions. */ +/* { dg-do compile } */ + +void foo(void) +{ + char buf[({ 4; })]; +} diff --git a/gcc/testsuite/gcc.dg/debug/20031231-1.c b/gcc/testsuite/gcc.dg/debug/20031231-1.c new file mode 100644 index 000000000..fa20260b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20031231-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +/* We used to fail because GCC didn't expect always inline to be inlined at + -O0. */ +typedef union tree_node *tree; +typedef struct c_pretty_print_info c_pretty_printer; + + +void pp_c_string_literal (c_pretty_printer *, tree); + + +static __inline__ __attribute__((always_inline)) void +pp_c_shift_expression (c_pretty_printer *pp, tree e) +{ +} + +static void +pp_c_relational_expression (c_pretty_printer *pp, tree e) +{ + pp_c_shift_expression (pp, e); +} diff --git a/gcc/testsuite/gcc.dg/debug/20041023-1.c b/gcc/testsuite/gcc.dg/debug/20041023-1.c new file mode 100644 index 000000000..12b7cb9a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20041023-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +static void +foo (unsigned char x) +{ + unsigned char a[5 + x]; +} + +void +bar (void) +{ + foo (80); +} diff --git a/gcc/testsuite/gcc.dg/debug/20041219-1.c b/gcc/testsuite/gcc.dg/debug/20041219-1.c new file mode 100644 index 000000000..6a62bb95b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20041219-1.c @@ -0,0 +1,8 @@ +/* PR 18067 */ +/* { dg-do compile } */ + +void foo(int i) +{ + const int j=i+1; + int a[1][j*j]; +} diff --git a/gcc/testsuite/gcc.dg/debug/20050907-1.c b/gcc/testsuite/gcc.dg/debug/20050907-1.c new file mode 100644 index 000000000..0112ff7d3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/20050907-1.c @@ -0,0 +1,24 @@ +/* PR 23190 */ +/* Well, collateral damage from a proposed patch fixing 23190. We'd emit + debug info for multilib_exclusions_raw without emitting the variable + itself, leading to link errors. This reduced form is filed as PR 23777, + for not eliminating things soon enough. */ +/* { dg-do link } */ + +static const char *const multilib_exclusions_raw[] = { 0 }; + +void __attribute__((noinline)) f(char *const *p) +{ + __asm__ ("" : : "g"(p) : "memory"); +} + +void g (char **o) +{ + const char *const *q = multilib_exclusions_raw; + + f (o); + while (*q++) + f (o); +} + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/debug/const-1.c b/gcc/testsuite/gcc.dg/debug/const-1.c new file mode 100644 index 000000000..bc526612f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/const-1.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +typedef float FloatVect __attribute__((__vector_size__(16))); +static FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 }; diff --git a/gcc/testsuite/gcc.dg/debug/const-2.c b/gcc/testsuite/gcc.dg/debug/const-2.c new file mode 100644 index 000000000..7b9c24403 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/const-2.c @@ -0,0 +1,2 @@ +/* { dg-do compile } */ +static __complex__ int x = 3.0; diff --git a/gcc/testsuite/gcc.dg/debug/const-3.c b/gcc/testsuite/gcc.dg/debug/const-3.c new file mode 100644 index 000000000..2e9db490c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/const-3.c @@ -0,0 +1,7 @@ +/* Make sure we don't emit strings just because of debug information + for string initializers. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ +/* { dg-final { scan-assembler-not "dontgenerate" } } */ +static const char *p = "dontgenerate1"; +static const char *q[2] = { 0, "dontgenerate2" }; diff --git a/gcc/testsuite/gcc.dg/debug/crash1.c b/gcc/testsuite/gcc.dg/debug/crash1.c new file mode 100644 index 000000000..259e259f4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/crash1.c @@ -0,0 +1,8 @@ +/* PR c/14492 */ +/* { dg-options "" } */ + +int main() { + double d = 1.0; + char x[(int) d]; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/debug-1.c b/gcc/testsuite/gcc.dg/debug/debug-1.c new file mode 100644 index 000000000..35b5c91b1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/debug-1.c @@ -0,0 +1,34 @@ +/* Verify that the scheduler does not discard the lexical block. */ +/* { dg-do compile } */ +/* { dg-options "-dA" } */ +/* On MIPS targets that support conditional moves, the optimal + implementation of this function is: + + l[wd] tmp,p + li $2,2 + jr $31 + movz $2,$0,tmp + + After if-conversion, we have a conditional move into a pseudo P + followed a copy of P into the return register ($2). P is associated + with xyzzy, so if-conversion is behaving as expected, and has not lost + the variable association. The destination of the second instruction + is associated with the function return value. Combine then combines + these two instructions, removing the last use of P and xyzzy. + + Everything is behaving as expected in this scenario, so we avoid + using conditional moves for this test. */ +/* { dg-options "-dA -fno-if-conversion" { target mips*-*-* } } */ +/* { dg-final { scan-assembler "xyzzy" } } */ + +long p; + +long foo(void) +{ + { + long xyzzy = 0; + if (p) + xyzzy = 2; + return xyzzy; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/debug-2.c b/gcc/testsuite/gcc.dg/debug/debug-2.c new file mode 100644 index 000000000..1e86f2fc7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/debug-2.c @@ -0,0 +1,24 @@ +/* Verify that the scheduler does not discard the lexical block. */ +/* { dg-do compile } */ +/* { dg-options "-dA" } */ +/* See the comment in debug-1.c. */ +/* { dg-options "-dA -fno-if-conversion" { target mips*-*-* } } */ +/* { dg-final { scan-assembler "xyzzy" } } */ + +long p; + +long foo(void) +{ + if (1) + { + long xyzzy = 0; + if (p) + xyzzy = 2; + return xyzzy; + } + else + { + int x = 0; + return x; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/debug-3.c b/gcc/testsuite/gcc.dg/debug/debug-3.c new file mode 100644 index 000000000..e2b7a4b18 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/debug-3.c @@ -0,0 +1,35 @@ +/* This testcase failed, because scope containing baz was deleted + (spanned 0 basic blocks) and DWARF-2 couldn't find baz origin. */ +/* { dg-do compile } */ +/* { dg-require-effective-target trampolines } */ + +struct A { char *a, *b, *c, *d; }; + +static int +bar (struct A *x) +{ + return x->c - x->b; +} + +void fnptr (void (*fn) (void)); + +void +foo (void) +{ + struct A e; + + { + void baz (void) + { + bar (&e); + } + fnptr (baz); + } + { + struct A *f; + + f = &e; + if (f->c - f->a > f->d - f->a) + f->c = f->d; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/debug-4.c b/gcc/testsuite/gcc.dg/debug/debug-4.c new file mode 100644 index 000000000..62e824a54 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/debug-4.c @@ -0,0 +1,26 @@ +/* This testcase failed, because scope containing baz was not emitted + (doesn't contain any instructions) and DWARF-2 couldn't find baz origin. */ +/* { dg-do compile } */ + +struct A { char *a, *b, *c, *d; }; + +static int +bar (struct A *x) +{ + return x->c - x->b; +} + +void +foo (void) +{ + struct A e; + + { + int baz (void) + { + return bar (&e); + } + } + if (e.c - e.a > e.d - e.a) + e.c = e.d; +} diff --git a/gcc/testsuite/gcc.dg/debug/debug-5.c b/gcc/testsuite/gcc.dg/debug/debug-5.c new file mode 100644 index 000000000..f66b861c8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/debug-5.c @@ -0,0 +1,47 @@ +/* This testcase failed, because scope containing baz was deleted + (spanned 0 basic blocks) and DWARF-2 couldn't find baz origin. */ +/* { dg-do compile } */ +/* { dg-require-effective-target trampolines } */ + +extern void abort (void); + +struct A { char *a, *b, *c, *d; }; + +static int +bar (struct A *x) +{ + return x->c - x->b; +} + +static int +bar2 (struct A *x) +{ + int a = x->c - x->b; + x->c += 26; + return a; +} + +void fnptr (void (*fn) (void)); + +void +foo (void) +{ + struct A e; + + if (bar2 (&e) < 0) + abort (); + { + void baz (void) + { + bar (&e); + } + fnptr (baz); + } + { + struct A *f; + + f = &e; + if (f->c - f->a > f->d - f->a) + f->c = f->d; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/debug-6.c b/gcc/testsuite/gcc.dg/debug/debug-6.c new file mode 100644 index 000000000..4fe680df0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/debug-6.c @@ -0,0 +1,38 @@ +/* Verify that bb-reorder re-inserts nested scopes properly. */ +/* { dg-do compile } */ +/* { dg-options "-dA" } */ +/* { dg-final { scan-assembler "xyzzy" } } */ + +extern void abort (void); + +struct A { char *a, *b, *c, *d; }; + +static int +bar2 (struct A *x) +{ + int a = x->c - x->b; + x->c += 26; + return a; +} + +void fnptr (int *); + +void +foo (void) +{ + struct A e; + + if (bar2 (&e) < 0) + abort (); + { + int xyzzy; + fnptr (&xyzzy); + } + { + struct A *f; + + f = &e; + if (f->c - f->a > f->d - f->a) + f->c = f->d; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/debug-7.c b/gcc/testsuite/gcc.dg/debug/debug-7.c new file mode 100644 index 000000000..d424e91f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/debug-7.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-dA" } */ +/* PR debug/12934. */ + +static inline int foo () +{ + return 42; +} + +void bar (int *); + +void baz () +{ + int a[foo ()]; + bar (a); +} diff --git a/gcc/testsuite/gcc.dg/debug/debug.exp b/gcc/testsuite/gcc.dg/debug/debug.exp new file mode 100644 index 000000000..94c1564a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/debug.exp @@ -0,0 +1,31 @@ +# Copyright (C) 2002, 2007 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/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +# Main loop. + +gcc-dg-debug-runtest gcc_target_compile trivial.c [list -O -O3] \ + [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2-1.c new file mode 100644 index 000000000..4ca98e2f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2-1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Alexandre Oliva <aoliva@cygnus.com> */ + +static int foo () { return 0; } + +void bar () { + int foo (); + int foo (); +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2-2.c new file mode 100644 index 000000000..0c3cee1a3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Alexandre Oliva <aoliva@redhat.com> */ + +inline double fx (double x) +{ + return 3 * x; +} + +main () +{ + double a = 0, fx (double), foo (); + fx (a); + if (a != 3) + foo (); +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2-3.c new file mode 100644 index 000000000..f0c129c60 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2-3.c @@ -0,0 +1,13 @@ +/* Test -feliminate-dwarf2-dups */ +/* Contributed by Devang Patel <dpatel@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-feliminate-dwarf2-dups" } */ + +#include "dwarf2-3.h" + +int main() +{ + struct point p; + p.x = 0; + p.y = 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-3.h b/gcc/testsuite/gcc.dg/debug/dwarf2-3.h new file mode 100644 index 000000000..26ad0bace --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2-3.h @@ -0,0 +1,9 @@ +/* Test -feliminate-dwarf2-dups */ +/* Contributed by Devang Patel <dpatel@apple.com> */ + +struct point +{ + int x; + int y; +}; + diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c new file mode 100644 index 000000000..8a97e4dc2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c @@ -0,0 +1,15 @@ +/* Test that .debug_aranges and .debug_ranges do not have an entry for the + text section if nothing went in there. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-require-effective-target function_sections } */ +/* { dg-options "-gdwarf-2 -ffunction-sections -w -dA" } */ +/* { dg-final { scan-assembler-not "\\.Letext0-\\.Ltext0" } } */ +/* { dg-final { scan-assembler-not "\\.Ltext0\[^\n\r\]*Offset 0x0" } } */ +/* { dg-final { scan-assembler "DW_AT_ranges" } } */ + +int +f (void) +{ + return 1; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c new file mode 100644 index 000000000..b7bd66a60 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c @@ -0,0 +1,9 @@ +// { dg-options "-std=iso9899:1999 -gdwarf-2" } + +void f() { + int n = 3; + typedef int T[n++]; + + T t; + t[0] = 7; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/const-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/const-2.c new file mode 100644 index 000000000..16e1d8bd1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/const-2.c @@ -0,0 +1,6 @@ +/* { dg-do compile { target powerpc_altivec_ok } } */ +/* { dg-options "-O -gdwarf-2 -dA -maltivec" } */ +/* { dg-final { scan-assembler "DW_AT_const_value" } } */ + +typedef float FloatVect __attribute__((__vector_size__(16))); +static FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 }; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/const-2b.c b/gcc/testsuite/gcc.dg/debug/dwarf2/const-2b.c new file mode 100644 index 000000000..6cbdc85b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/const-2b.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target i386*-*-* } } */ +/* { dg-options "-O -gdwarf-2 -dA -msse" } */ +/* { dg-require-effective-target sse } */ +/* { dg-final { scan-assembler "DW_AT_const_value" } } */ + +typedef float FloatVect __attribute__((__vector_size__(16))); +static FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 }; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char1.c new file mode 100644 index 000000000..ed32349b4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char1.c @@ -0,0 +1,13 @@ +/* PR debug/7241 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-skip-if "Unmatchable assembly" { mmix-*-* } { "*" } { "" } } */ +/* { dg-final { scan-assembler "0x\[68\]\[ \t\]+\[#@;!/|\]+\[ \t\]+DW_AT_encoding" } } */ +/* { dg-final { scan-assembler-not "0x\[57\]\[ \t\]+\[#@;!/|\]+\[ \t\]+DW_AT_encoding" } } */ + +char a; +const char b; +signed char c; +volatile signed char d; +unsigned char e; +volatile const unsigned char f; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char2.c new file mode 100644 index 000000000..dc145852f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char2.c @@ -0,0 +1,13 @@ +/* PR debug/7241 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-skip-if "Unmatchable assembly" { mmix-*-* } { "*" } { "" } } */ +/* { dg-final { scan-assembler "0x\[68\]\[ \t\]+\[#@;!/|\]+\[ \t\]+DW_AT_encoding" } } */ +/* { dg-final { scan-assembler-not "0x\[57\]\[ \t\]+\[#@;!/|\]+\[ \t\]+DW_AT_encoding" } } */ + +const char a; +char b; +volatile signed char c; +signed char d; +const volatile unsigned char e; +unsigned char f; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char3.c new file mode 100644 index 000000000..edc1d83ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-char3.c @@ -0,0 +1,8 @@ +/* PR debug/7241 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-skip-if "Unmatchable assembly" { mmix-*-* } { "*" } { "" } } */ +/* { dg-final { scan-assembler "0x\[68\]\[ \t\]+\[#@;!/|\]+\[ \t\]+DW_AT_encoding" } } */ +/* { dg-final { scan-assembler-not "0x\[57\]\[ \t\]+\[#@;!/|\]+\[ \t\]+DW_AT_encoding" } } */ + +const char *p = "abc"; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-dfp.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-dfp.c new file mode 100644 index 000000000..ddb602250 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-dfp.c @@ -0,0 +1,16 @@ +/* Verify the DWARF encoding of C99 decimal floating point types. */ + +/* { dg-do compile */ +/* { dg-require-effective-target dfp } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler "0x10.*DW_AT_encoding" } } */ +/* { dg-final { scan-assembler "0x4.*DW_AT_byte_size" } } */ +/* { dg-final { scan-assembler "0x8.*DW_AT_byte_size" } } */ +/* { dg-final { scan-assembler "0x10.*DW_AT_byte_size" } } */ + +void foo () +{ + _Decimal32 f = 1.5df; + _Decimal64 d = 1.5dd; + _Decimal128 l = 1.5dl; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die1.c new file mode 100644 index 000000000..fdfbf8321 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die1.c @@ -0,0 +1,8 @@ +/* Verify that inline function never actually inlined has no abstract DIE. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler-not "DW_AT_inline" } } */ +inline int t() +{ +} +int (*q)()=t; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die2.c new file mode 100644 index 000000000..ac897ab78 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die2.c @@ -0,0 +1,7 @@ +/* Verify that inline function never actually emit has no DIE. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler-not "CIE Version" } } */ +static inline int t() +{ +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die3.c new file mode 100644 index 000000000..04b2f36c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die3.c @@ -0,0 +1,11 @@ +/* Verify that extern inline function never actually inlined has no abstract DIE. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler-not "DW_AT_inline" } } */ +extern inline int t() +{ +} +int (*q)()=t; +int t() +{ +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die5.c new file mode 100644 index 000000000..3fefd41ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die5.c @@ -0,0 +1,12 @@ +/* Inlined inline function must have abstract DIE */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA -fpreprocessed" } */ +/* { dg-final { scan-assembler "3.*DW_AT_inline" } } */ +#1 "test.h" +inline int t() +{ +} +int q() +{ + t(); +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die6.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die6.c new file mode 100644 index 000000000..d8f477f54 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die6.c @@ -0,0 +1,12 @@ +/* not inline inline function must not have abstract DIE */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-inline -gdwarf-2 -dA -fpreprocessed" } */ +/* { dg-final { scan-assembler-not "DW_AT_inline" } } */ +#1 "test.h" +inline int t() +{ +} +int q() +{ + t(); +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die7.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die7.c new file mode 100644 index 000000000..b747076ba --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-die7.c @@ -0,0 +1,14 @@ +/* Inlined non-inline function must have abstract DIE */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA -fpreprocessed" } */ +/* { dg-final { scan-assembler "1.*DW_AT_inline" } } */ +#1 "test.h" +void f(void); +static int t() +{ + f(); +} +int q() +{ + t(); +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-file1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-file1.c new file mode 100644 index 000000000..c68dfe436 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-file1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler "File Entry:|.file" } } */ +/* Verify that a file entry is output for this file. Only systems that + do not define HAVE_AS_DWARF2_DEBUG_LINE will put out "File Entry:", + but systems that do define HAVE_AS_DWARF2_DEBUG_LINE will put out a + ".file" so we check for either. */ + +int bar = 3; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-float.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-float.c new file mode 100644 index 000000000..84d605fcd --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-float.c @@ -0,0 +1,15 @@ +/* Verify the DWARF encoding of C99 floating point types. */ + +/* { dg-do compile */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler "0x4.*DW_AT_encoding" } } */ +/* { dg-final { scan-assembler "0x4.*DW_AT_byte_size" } } */ +/* { dg-final { scan-assembler "0x8.*DW_AT_byte_size" } } */ +/* { dg-final { scan-assembler "0x10.*DW_AT_byte_size" } } */ + +void foo () +{ + float f = 1.5f; + double d = 1.5; + long double l = 1.5l; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-merge.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-merge.c new file mode 100644 index 000000000..767d38b17 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-merge.c @@ -0,0 +1,10 @@ +/* Verify that mergeable strings are used in the CU DIE. */ +/* { dg-do compile } */ +/* { dg-require-effective-target string_merging } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" } } */ +/* { dg-final { scan-assembler-not "GNU C\[^\\n\\r\]*DW_AT_producer" } } */ + +void func (void) +{ +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c new file mode 100644 index 000000000..7bcebe355 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler "DW_TAG_variable" } } */ +/* PR debug/21828 */ + +static int i; +int main() { + i += 3; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c new file mode 100644 index 000000000..4efb25e8c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c @@ -0,0 +1,13 @@ +/* Test to make sure the mcaro info includes a start file command for the main source */ +/* { dg-do compile } */ +/* { dg-options "-g3 -gdwarf-2 -dA -fverbose-asm" } */ +/* { dg-final { scan-assembler "Start new file" } } */ + +#define ADD(x) (M + x) + +int main (void) +{ +#define N 28 +#define M 42 + return ADD(N); +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp new file mode 100644 index 000000000..dfc387dbe --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp @@ -0,0 +1,43 @@ +# Copyright (C) 2002, 2007, 2010 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/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors -gdwarf-2" +} + +# Initialize `dg'. +dg-init + +# Main loop. +set comp_output [gcc_target_compile \ + "$srcdir/$subdir/../trivial.c" "trivial.S" assembly \ + "additional_flags=-gdwarf-2"] +if { ! [string match "*: target system does not support the * debug format*" \ + $comp_output] } { + remove-build-file "trivial.S" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\] $srcdir/c-c++-common/dwarf2/*.c]] \ + "" $DEFAULT_CFLAGS +} + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-any.c b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-any.c new file mode 100644 index 000000000..fc510903c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-any.c @@ -0,0 +1,84 @@ +// { dg-do compile } +// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=any" } +// { dg-final { scan-assembler "timespec.*DW_AT_name" } } +// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } } +// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } } +// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } } +// { dg-final { scan-assembler "it_interval.*DW_AT_name" } } +// { dg-final { scan-assembler "it_value.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_var_head_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_var_head_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_var_head_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } } +# 1 "fesd-any.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 1 "fesd-any.c" + +//#include "time.h" +# 1 "time.h" 1 3 4 +struct timespec + { + long int tv_sec; + long int tv_nsec; + }; + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + +# 6 "fesd-any.c" 2 + +struct timespec base_var8; +struct itimerspec *base_var9; + +#include "fesd-any.h" + +struct gstruct_head_ordy_defn_var_base base_var1; +struct gstruct_base_ordy_defn_var_base base_var2; + +int base_function() { + return 0 ++ base_var1.field_head_ordy_defn_var_base ++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base ++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base ++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base ++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base +; +} + diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-any.h b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-any.h new file mode 100644 index 000000000..a7146b65e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-any.h @@ -0,0 +1,19 @@ +#include "fesd.h" + +struct gstruct_base_ordy_decl_not; +struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; }; + +struct gstruct_base_ordy_decl_ref_base; +struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; }; +struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; }; +struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; }; +struct gstruct_base_ordy_defn_var_base { + struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc; + struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref; + struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr; + struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld; + struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc; + struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref; + struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr; + struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld; +}; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-baseonly.c b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-baseonly.c new file mode 100644 index 000000000..a32abb5a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-baseonly.c @@ -0,0 +1,83 @@ +// { dg-do compile } +// { dg-options "-gdwarf-2 -dA -femit-struct-debug-baseonly" } +// { dg-final { scan-assembler "timespec.*DW_AT_name" } } +// { dg-final { scan-assembler-not "tv_sec.*DW_AT_name" } } +// { dg-final { scan-assembler-not "tv_nsec.*DW_AT_name" } } +// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } } +// { dg-final { scan-assembler-not "it_interval.*DW_AT_name" } } +// { dg-final { scan-assembler-not "it_value.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } } +# 1 "fesd-baseonly.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 1 "fesd-baseonly.c" + +//#include "time.h" +# 1 "time.h" 1 3 4 +struct timespec + { + long int tv_sec; + long int tv_nsec; + }; + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + +# 6 "fesd-baseonly.c" 2 + +struct timespec base_var8; +struct itimerspec *base_var9; + +#include "fesd-baseonly.h" + +struct gstruct_head_ordy_defn_var_base base_var1; +struct gstruct_base_ordy_defn_var_base base_var2; + +int base_function() { + return 0 ++ base_var1.field_head_ordy_defn_var_base ++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base ++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base ++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base ++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base +; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-baseonly.h b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-baseonly.h new file mode 100644 index 000000000..a7146b65e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-baseonly.h @@ -0,0 +1,19 @@ +#include "fesd.h" + +struct gstruct_base_ordy_decl_not; +struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; }; + +struct gstruct_base_ordy_decl_ref_base; +struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; }; +struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; }; +struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; }; +struct gstruct_base_ordy_defn_var_base { + struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc; + struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref; + struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr; + struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld; + struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc; + struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref; + struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr; + struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld; +}; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-none.c b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-none.c new file mode 100644 index 000000000..bd218f826 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-none.c @@ -0,0 +1,84 @@ +// { dg-do compile } +// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=none" } +// { dg-final { scan-assembler "timespec.*DW_AT_name" } } +// { dg-final { scan-assembler-not "tv_sec.*DW_AT_name" } } +// { dg-final { scan-assembler-not "tv_nsec.*DW_AT_name" } } +// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } } +// { dg-final { scan-assembler-not "it_interval.*DW_AT_name" } } +// { dg-final { scan-assembler-not "it_value.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } } +# 1 "fesd-none.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 1 "fesd-none.c" + +//#include "time.h" +# 1 "time.h" 1 3 4 +struct timespec + { + long int tv_sec; + long int tv_nsec; + }; + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + +# 6 "fesd-none.c" 2 + +struct timespec base_var8; +struct itimerspec *base_var9; + +#include "fesd-none.h" + +struct gstruct_head_ordy_defn_var_base base_var1; +struct gstruct_base_ordy_defn_var_base base_var2; + +int base_function() { + return 0 ++ base_var1.field_head_ordy_defn_var_base ++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base ++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base ++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base ++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base +; +} + diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-none.h b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-none.h new file mode 100644 index 000000000..a7146b65e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-none.h @@ -0,0 +1,19 @@ +#include "fesd.h" + +struct gstruct_base_ordy_decl_not; +struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; }; + +struct gstruct_base_ordy_decl_ref_base; +struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; }; +struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; }; +struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; }; +struct gstruct_base_ordy_defn_var_base { + struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc; + struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref; + struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr; + struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld; + struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc; + struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref; + struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr; + struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld; +}; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-reduced.c b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-reduced.c new file mode 100644 index 000000000..ac599f43f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-reduced.c @@ -0,0 +1,83 @@ +// { dg-do compile } +// { dg-options "-gdwarf-2 -dA -femit-struct-debug-reduced" } +// { dg-final { scan-assembler "timespec.*DW_AT_name" } } +// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } } +// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } } +// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } } +// { dg-final { scan-assembler "it_interval.*DW_AT_name" } } +// { dg-final { scan-assembler "it_value.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } } +# 1 "fesd-reduced.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 1 "fesd-reduced.c" + +//#include "time.h" +# 1 "time.h" 1 3 4 +struct timespec + { + long int tv_sec; + long int tv_nsec; + }; + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + +# 6 "fesd-reduced.c" 2 + +struct timespec base_var8; +struct itimerspec *base_var9; + +#include "fesd-reduced.h" + +struct gstruct_head_ordy_defn_var_base base_var1; +struct gstruct_base_ordy_defn_var_base base_var2; + +int base_function() { + return 0 ++ base_var1.field_head_ordy_defn_var_base ++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base ++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base ++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base ++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base +; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-reduced.h b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-reduced.h new file mode 100644 index 000000000..a7146b65e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-reduced.h @@ -0,0 +1,19 @@ +#include "fesd.h" + +struct gstruct_base_ordy_decl_not; +struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; }; + +struct gstruct_base_ordy_decl_ref_base; +struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; }; +struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; }; +struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; }; +struct gstruct_base_ordy_defn_var_base { + struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc; + struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref; + struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr; + struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld; + struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc; + struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref; + struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr; + struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld; +}; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-sys.c b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-sys.c new file mode 100644 index 000000000..3a5c0bf14 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-sys.c @@ -0,0 +1,83 @@ +// { dg-do compile } +// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=sys" } +// { dg-final { scan-assembler "timespec.*DW_AT_name" } } +// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } } +// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } } +// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } } +// { dg-final { scan-assembler "it_interval.*DW_AT_name" } } +// { dg-final { scan-assembler "it_value.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } } +// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } } +// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } } +// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } } +# 1 "fesd-sys.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 1 "fesd-sys.c" + +//#include "time.h" +# 1 "time.h" 1 3 4 +struct timespec + { + long int tv_sec; + long int tv_nsec; + }; + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + +# 6 "fesd-sys.c" 2 + +struct timespec base_var8; +struct itimerspec *base_var9; + +#include "fesd-sys.h" + +struct gstruct_head_ordy_defn_var_base base_var1; +struct gstruct_base_ordy_defn_var_base base_var2; + +int base_function() { + return 0 ++ base_var1.field_head_ordy_defn_var_base ++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base ++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base ++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base ++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base +; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-sys.h b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-sys.h new file mode 100644 index 000000000..a7146b65e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd-sys.h @@ -0,0 +1,19 @@ +#include "fesd.h" + +struct gstruct_base_ordy_decl_not; +struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; }; + +struct gstruct_base_ordy_decl_ref_base; +struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; }; +struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; }; +struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; }; +struct gstruct_base_ordy_defn_var_base { + struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc; + struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref; + struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr; + struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld; + struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc; + struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref; + struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr; + struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld; +}; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/fesd.h b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd.h new file mode 100644 index 000000000..46b24f5e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/fesd.h @@ -0,0 +1,36 @@ +/* +where from: base = matching base; head = other header +what kind: ordy = ordinary struct; tmpl = template struct +definition: decl = incomplete declaration; defn = full definition +how used: not = not used; ref = by ref; ptr = through pointer; + fld = as field; var = as variable +from where: base = from base; head = other header +*/ + +struct gstruct_head_ordy_decl_not; +struct gstruct_head_ordy_defn_not { int field_head_ordy_defn_not; }; + +struct gstruct_head_ordy_decl_ref_head; +struct gstruct_head_ordy_defn_ref_head { int field_head_ordy_defn_ref_head; }; +struct gstruct_head_ordy_defn_ptr_head { int field_head_ordy_defn_ptr_head; }; +struct gstruct_head_ordy_defn_fld_head { int field_head_ordy_defn_fld_head; }; +struct gstruct_head_ordy_defn_var_head { + struct gstruct_head_ordy_decl_ref_head *field_head_ordy_defn_var_head_inc; + struct gstruct_head_ordy_defn_ref_head *field_head_ordy_defn_var_head_ref; + struct gstruct_head_ordy_defn_ptr_head *field_head_ordy_defn_var_head_ptr; + struct gstruct_head_ordy_defn_fld_head field_head_ordy_defn_var_head_fld; +}; +extern struct gstruct_head_ordy_defn_var_head head_var1; + +struct gstruct_head_ordy_decl_ref_base; +struct gstruct_head_ordy_defn_ref_base { int field_head_ordy_defn_ref_base; }; +struct gstruct_head_ordy_defn_ptr_base { int field_head_ordy_defn_ptr_base; }; +struct gstruct_head_ordy_defn_fld_base { int field_head_ordy_defn_fld_base; }; +struct gstruct_head_ordy_defn_var_base { int field_head_ordy_defn_var_base; }; + +inline int head_function() { + return 0 ++ head_var1.field_head_ordy_defn_var_head_ptr->field_head_ordy_defn_ptr_head ++ head_var1.field_head_ordy_defn_var_head_fld.field_head_ordy_defn_fld_head +; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/global-used-types.c b/gcc/testsuite/gcc.dg/debug/dwarf2/global-used-types.c new file mode 100644 index 000000000..54fa58ae3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/global-used-types.c @@ -0,0 +1,14 @@ +/* + Contributed by Dodji Seketeli <dodji@redhat.com> + { dg-options "-g -dA -fno-merge-debug-strings" } + { dg-do compile } + { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_enumeration_type" 1 } } + { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_enumerator" 2 } } + { dg-final { scan-assembler-times "ascii \"a.0\"\[\t \]+\[^\n\]*DW_AT_name" 1 } } + { dg-final { scan-assembler-times "ascii \"b.0\"\[\t \]+\[^\n\]*DW_AT_name" 1 } } + */ + +enum { a, b }; + +int v = a; +char s[b]; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline1.c new file mode 100644 index 000000000..11c8fad78 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ +void e(int); +__attribute__ ((always_inline)) inline int +t(int function_parameter) +{ + e(function_parameter); +} + +void test (int function_parameter2) +{ + t(function_parameter2); +} + +/* Verify that we get both function_parameter and function_parameter2 declared + in test. Overall we should have 3 variables with location defined (also + function_parameter in offline copy of t. */ +/* { dg-final { scan-assembler-times " DW_AT_location" 3 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c new file mode 100644 index 000000000..20edb588e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c @@ -0,0 +1,70 @@ +/* Contributed by Dodji Seketeli <dodji@redhat.com> + Origin: PR debug/37801 + + Abstract instances (DW_TAG_subroutines having the DW_AT_inline attribute) + of second and first were having a DW_TAG_lexical_block DIE wrongly + representing the inlined calls to third (in second) and to + second (in first). At the same time, main didn't have children + DW_TAG_inlined_subroutine DIEs representing the inlined calls to + first, second and third. + + The ideal goal here is to test that we have no superfluous + DW_TAG_lexical_block DIE anymore, that abstract instances DIEs have + no descendant DIE with a DW_AT_abstract_origin attribute, and that main has + properly nested DW_TAG_inlined_subroutine DIEs for third, second and first. +*/ + +/* { dg-options "-O -g3 -dA" } */ +/* { dg-do compile } */ + +/* There are 6 inlined subroutines: + - One for each subroutine inlined into main, that's 3. + - One for earch subroutine inline into the out of line instances + of third, second and first. */ +/* { dg-final { scan-assembler-times "\\(DIE \\(\[^\n\]*\\) DW_TAG_inlined_subroutine" 6 } } */ + +/* Likewise we should have 6 DW_TAG_lexical_block DIEs: + - One for each subroutine inlined into main, so that's 3. + - One for each subroutine inlined in the out of line instances + of third, second and first, that's 3. +*/ +/* { dg-final { scan-assembler-times "\\(DIE \\(\[^\n\]*\\) DW_TAG_lexical_block" 6 } } */ + + +/* There are 3 DW_AT_inline attributes: one per abstract inline instance. + The value of the attribute must be 0x3, meaning the function was + actually inlined. */ +/* { dg-final { scan-assembler-times "(?:byte|data1)\[^\n\]*0x3\[^\n\]* DW_AT_inline" 3 } } */ + +volatile int *a; + +inline void +third (int arg3) +{ + int var3 = arg3; + a[0] = var3; +} + +inline void +second (int arg2) +{ + int var2 = arg2; + third (var2+1); +} + +inline void +first (int arg1) +{ + int var1 = arg1; + second (var1+1); +} + +int +main () +{ + int some_int = 1; + first (some_int); + return 0; +} + + diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline3.c new file mode 100644 index 000000000..feafb33e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline3.c @@ -0,0 +1,22 @@ +/* Verify that only one DW_AT_const_value is emitted for baz, + not for baz abstract DIE and again inside of + DW_TAG_inlined_subroutine. */ +/* { dg-options "-O2 -g -dA" } */ +/* { dg-do compile } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value" 1 } } */ + +struct A { const long i; const long j; }; + +static inline long +foo (void) +{ + const struct A baz = { .i = 2, .j = 21 }; + asm volatile ("" : : : "memory"); + return baz.i * baz.j; +} + +int +main () +{ + return foo () - 42; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/ipa-cp1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/ipa-cp1.c new file mode 100644 index 000000000..7442dab19 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/ipa-cp1.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +void q(int p); +static void +t(int constant_propagated_par) +{ + int local_var = constant_propagated_par + 1; + q(local_var); + q(local_var); + q(local_var); + q(local_var); + q(local_var); + q(local_var); + q(local_var); + q(local_var); + q(local_var); + q(local_var); + q(local_var); +} +main() +{ + t(5); + t(5); + t(5); + t(5); + t(5); + t(5); + t(5); +} +/* { dg-final { scan-assembler "local_var" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr29609-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr29609-1.c new file mode 100644 index 000000000..5476aac0a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr29609-1.c @@ -0,0 +1,32 @@ +/* PR debug/29609 */ +/* Verify that breakpoint on the break is hit. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ + +void abort (void); + +int +foo (void) +{ + int a, i; + + for (i = 1; i <= 10; i++) + { + if (i < 3) + a = 1; + else + break; + a = 5; + } + return a; +} + +int +main (void) +{ + if (foo () != 5) + abort (); + return 0; +} + +/* { dg-final { scan-assembler "pr29609-1.c:18" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr29609-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr29609-2.c new file mode 100644 index 000000000..43bc54524 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr29609-2.c @@ -0,0 +1,53 @@ +/* PR debug/29609 */ +/* Verify that breakpoint on both goto failure; stmts is hit. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ + +extern void abort (void); +int x; + +int +foo (void) +{ + return 0 ^ x; +} + +int +bar (void) +{ + return 1 ^ x; +} + +int +baz (void) +{ + int c; + + if (!foo ()) + goto failure; + + if (!bar ()) + goto failure; + + return 0; + +failure: + return 1; +} + +int +main (void) +{ + if (baz () != 1) + abort (); + x = 1; + if (baz () != 1) + abort (); + x = 2; + if (baz () != 0) + abort (); + return 0; +} + +/* { dg-final { scan-assembler "pr29609-2.c:27" } } */ +/* { dg-final { scan-assembler "pr29609-2.c:30" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr31230.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr31230.c new file mode 100644 index 000000000..ce26ec639 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr31230.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf-2 -dA --param ggc-min-expand=0 --param ggc-min-heapsize=0" } */ +/* { dg-final { scan-assembler-times "DIE.*DW_TAG_array_type" 1 } } */ +/* { dg-final { scan-assembler-times "DIE.*DW_TAG_subrange_type" 1 } } */ + +void f1 (void) +{ + char buffer1[100]; +} + +int f2 (void) +{ + return 0; +} + +void f3 (void) +{ + char buffer2[100]; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-1.c new file mode 100644 index 000000000..de90acb81 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-1.c @@ -0,0 +1,22 @@ +/* PR debug/36690 */ +/* Verify that break func is hit. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ + +int i; + +void +func (void) +{ + while (i == 1) + i = 0; +} + +int +main (void) +{ + func (); + return 0; +} + +/* { dg-final { scan-assembler "pr36690-1.c:11" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-2.c new file mode 100644 index 000000000..2330f5385 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-2.c @@ -0,0 +1,39 @@ +/* PR debug/36690 */ +/* Verify that breakpoint can be put on goto f1, it is hit and + varz at that spot is defined and contains 5. Nowhere else + in the function should be varz in the scope. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ + +int cnt; + +void +bar (int i) +{ + cnt += i; +} + +void +foo (int i) +{ + if (!i) + bar (0); + else + { + static int varz = 5; + goto f1; + } + bar (1); +f1: + bar (2); +} + +int +main (void) +{ + foo (0); + foo (1); + return 0; +} + +/* { dg-final { scan-assembler "pr36690-2.c:24" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-3.c new file mode 100644 index 000000000..234ad1263 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr36690-3.c @@ -0,0 +1,53 @@ +/* PR debug/36690 */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ + +int cnt; + +void +bar (int i) +{ + cnt += i; +} + +void +foo (int i, int j) +{ + if (j) + { + bar (i + 1); + goto f1; + } + bar (i + 2); + goto f2; +f1: + if (i > 10) + goto f3; +f2: + if (i > 40) + goto f4; + else + goto f5; +f3: + bar (i); +f4: + bar (i); +f5: + bar (i); +} + +int +main (void) +{ + foo (0, 1); + foo (11, 1); + foo (21, 0); + foo (41, 0); + return 0; +} + +/* { dg-final { scan-assembler "pr36690-3.c:19" } } */ +/* { dg-final { scan-assembler "pr36690-3.c:22" } } */ +/* { dg-final { scan-assembler "pr36690-3.c:25" } } */ +/* { dg-final { scan-assembler "pr36690-3.c:28" } } */ +/* { dg-final { scan-assembler "pr36690-3.c:30" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr37616.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr37616.c new file mode 100644 index 000000000..badff447a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr37616.c @@ -0,0 +1,41 @@ +/* PR debug/37616 */ +/* Test that one can put breakpoints onto continue, exitlab and break + and actually see program reaching those breakpoints. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ + +extern void abort (void); + +int +foo (int parm) +{ + int varj, varm; + + for (varj = 0; varj < 10; varj++) + { + if (varj == 5) + continue; + if (varj == 7 && !parm) + goto exitlab; + if (varj == 9) + break; + varm = varj; + } + +exitlab: + return varm; +} + +int +main (void) +{ + if (foo (0) != 6) + abort (); + if (foo (1) != 8) + abort (); + return 0; +} + +/* { dg-final { scan-assembler "pr37616.c:17" } } */ +/* { dg-final { scan-assembler "pr37616.c:19" } } */ +/* { dg-final { scan-assembler "pr37616.c:21" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c new file mode 100644 index 000000000..60fb83961 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c @@ -0,0 +1,25 @@ +/* PR debug/37726 */ +/* { dg-do compile } */ +/* { dg-options "-g -O0 -dA -fno-merge-debug-strings" } */ + +int foo (int parm) +{ + int var = 0; + int bar (void) + { + return parm + var; + } + parm++; + var++; + return bar (); +} + +int +main (void) +{ + return foo (4) - 6; +} + +/* Both parm and var variables should be in debug info for both foo and bar. */ +/* { dg-final { scan-assembler-times "\"parm\[^\n\]*\"\[^\n\]*DW_AT_name" 2 } } */ +/* { dg-final { scan-assembler-times "\"var\[^\n\]*\"\[^\n\]*DW_AT_name" 2 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-1.c new file mode 100644 index 000000000..452c0f680 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-1.c @@ -0,0 +1,18 @@ +/* PR preprocessor/41445 */ +/* Test that token after multi-line function-like macro use + gets correct locus even when preprocessing separately. */ +/* { dg-do compile } */ +/* { dg-options "-save-temps -g -O0 -dA -fno-merge-debug-strings" } */ + +#define A(a,b) +int varh;A(1, + + + + 2)int vari; +int varj; + +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varh\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?8\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xc|12)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xd|13)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-2.c new file mode 100644 index 000000000..d2ee408ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-2.c @@ -0,0 +1,9 @@ +/* PR preprocessor/41445 */ +/* { dg-do compile } */ +/* { dg-options "-g -O0 -dA -fno-merge-debug-strings" } */ + +#include "pr41445-1.c" + +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varh\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?8\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xc|12)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xd|13)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-3.c new file mode 100644 index 000000000..2a74dc5e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-3.c @@ -0,0 +1,18 @@ +/* PR preprocessor/41445 */ +/* Test that token after multi-line function-like macro use + gets correct locus even when preprocessing separately. */ +/* { dg-do compile } */ +/* { dg-options "-save-temps -g -O0 -dA -fno-merge-debug-strings" } */ + +#define A(a,b) +int varh;/* + +Some multi-line comment. + + */int vari; +int varj; + +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varh\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?8\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xc|12)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xd|13)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-4.c new file mode 100644 index 000000000..8aa92de5d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-4.c @@ -0,0 +1,9 @@ +/* PR preprocessor/41445 */ +/* { dg-do compile } */ +/* { dg-options "-g -O0 -dA -fno-merge-debug-strings" } */ + +#include "pr41445-3.c" + +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varh\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?8\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xc|12)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xd|13)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c new file mode 100644 index 000000000..03af604a7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c @@ -0,0 +1,14 @@ +/* PR preprocessor/41445 */ +/* Test that token after multi-line function-like macro use + gets correct locus even when preprocessing separately. */ +/* { dg-do compile } */ +/* { dg-options "-save-temps -g -O0 -dA -fno-merge-debug-strings" } */ + +#define A(x) vari x +#define vari(x) +#define B , varj +int A(B) ; + +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?7\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xa|10)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c new file mode 100644 index 000000000..8aa37d1c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c @@ -0,0 +1,8 @@ +/* PR preprocessor/41445 */ +/* { dg-do compile } */ +/* { dg-options "-g -O0 -dA -fno-merge-debug-strings" } */ + +#include "pr41445-5.c" + +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"vari\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?7\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"varj\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0xa|10)\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41543.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41543.c new file mode 100644 index 000000000..02683960b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41543.c @@ -0,0 +1,14 @@ +/* PR preprocessor/41543 */ +/* { dg-do compile } */ +/* { dg-options "-save-temps -g -O0 -dA -fno-merge-debug-strings" } */ + +#include <stdarg.h> + +int +foo (va_list ap) +{ + return va_arg (ap, int); +} + +/* { dg-final { scan-assembler-not "DW_AT_decl_file\[^\\r\\n\]*\(pr41543\.i\)" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr41695.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41695.c new file mode 100644 index 000000000..d61b5a293 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr41695.c @@ -0,0 +1,18 @@ +/* PR debug/41695 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2 -dA -fno-merge-debug-strings" } */ + +int bar (int); + +void +foo (void) +{ + int b = 0; + b = bar (b); + b = bar (b); + b = bar (b); + b = bar (b); + bar (b); +} + +/* { dg-final { scan-assembler-not "LVL(\[0-9\]+)-\[^1\]\[^\\r\\n\]*Location list begin address\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*LVL\\1-1-" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr43237.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr43237.c new file mode 100644 index 000000000..21262c3b2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr43237.c @@ -0,0 +1,31 @@ +/* PR debug/43237 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2 -dA -fno-merge-debug-strings" } */ + +struct S +{ + int *a; + int b; + int **c; + int d; +}; + +void foo (struct S *); +void bar (struct S *); + +int +baz (void) +{ + struct S s; + foo (&s); + { + int a[s.b]; + int *c[s.d]; + s.a = a; + s.c = c; + bar (&s); + } + return 0; +} + +/* { dg-final { scan-assembler-not "LLST\[^\\r\\n\]*DW_AT_upper_bound" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr49871.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr49871.c new file mode 100644 index 000000000..c1a58c4bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr49871.c @@ -0,0 +1,12 @@ +/* PR debug/49871 */ +/* { dg-do compile } */ +/* { dg-options "-gdwarf-3 -dA -fno-merge-debug-strings" } */ + +struct S +{ + char a[1 << 16]; + int b; +} s; + +/* { dg-final { scan-assembler "\\(DW_AT_data_member_location\\)\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(DW_FORM_udata\\)" } } */ +/* { dg-final { scan-assembler-not "\\(DW_AT_data_member_location\\)\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(DW_FORM_data\[48\]\\)" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c new file mode 100644 index 000000000..957c152b4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c @@ -0,0 +1,13 @@ +/* PR debug/51410 */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA -fno-merge-debug-strings" } */ + +int x; + +int +foo (void) +{ + return x; +} + +/* { dg-final { scan-assembler-times "\\(DIE\[^\\r\\n\]*DW_TAG_variable\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/short-circuit.c b/gcc/testsuite/gcc.dg/debug/dwarf2/short-circuit.c new file mode 100644 index 000000000..7e745ff19 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/short-circuit.c @@ -0,0 +1,108 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf-2 -dA" } */ + +#define True 1 +#define False 0 + +_Bool F1 (_Bool B1, _Bool B2) +{ + _Bool R; + + if (B1 + && B2) + R = True; + else + R = False; + return R; +} + +_Bool F2 (_Bool B1, _Bool B2) +{ + _Bool R; + + R = B1 + && B2; + return R; +} + +_Bool F3 (_Bool B1, _Bool B2) +{ + _Bool R = False; + + if (B1 + && B2) + R = True; + return R; +} + +_Bool F4 (_Bool B1, _Bool B2) +{ + _Bool R = False; + + if (B1 + || B2) + ; + else + R = True; + return R; +} + +_Bool F5 (_Bool B1, _Bool B2) +{ + _Bool R = False; + + if (!(B1 + && B2)) + R = True; + return R; +} + +_Bool F8 (_Bool B1, _Bool B2, _Bool B3, _Bool B4, _Bool B5, _Bool B6, + _Bool B7, _Bool B8) +{ + _Bool R; + + if ((B1 + || B2) + && B3 + && !(B4 + || B5) + && (B6 + || (B7 + && B8))) + R = True; + else + R = False; + return R; +} + +/* { dg-final { scan-assembler "short-circuit.c:11" } } */ +/* { dg-final { scan-assembler "short-circuit.c:12" } } */ +/* { dg-final { scan-assembler "short-circuit.c:13" } } */ +/* { dg-final { scan-assembler "short-circuit.c:15" } } */ + +/* { dg-final { scan-assembler "short-circuit.c:23" } } */ +/* { dg-final { scan-assembler "short-circuit.c:24" } } */ + +/* { dg-final { scan-assembler "short-circuit.c:32" } } */ +/* { dg-final { scan-assembler "short-circuit.c:33" } } */ +/* { dg-final { scan-assembler "short-circuit.c:34" } } */ + +/* { dg-final { scan-assembler "short-circuit.c:42" } } */ +/* { dg-final { scan-assembler "short-circuit.c:43" } } */ +/* { dg-final { scan-assembler "short-circuit.c:46" } } */ + +/* { dg-final { scan-assembler "short-circuit.c:54" } } */ +/* { dg-final { scan-assembler "short-circuit.c:55" } } */ +/* { dg-final { scan-assembler "short-circuit.c:56" } } */ + +/* { dg-final { scan-assembler "short-circuit.c:65" } } */ +/* { dg-final { scan-assembler "short-circuit.c:66" } } */ +/* { dg-final { scan-assembler "short-circuit.c:67" } } */ +/* { dg-final { scan-assembler "short-circuit.c:68" } } */ +/* { dg-final { scan-assembler "short-circuit.c:69" } } */ +/* { dg-final { scan-assembler "short-circuit.c:70" } } */ +/* { dg-final { scan-assembler "short-circuit.c:71" } } */ +/* { dg-final { scan-assembler "short-circuit.c:72" } } */ +/* { dg-final { scan-assembler "short-circuit.c:73" } } */ +/* { dg-final { scan-assembler "short-circuit.c:75" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/static1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/static1.c new file mode 100644 index 000000000..b9b5d0b37 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/static1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2" } */ +void +main(void) +{ + static int unused_local_var; +} +/* { dg-final { scan-assembler "unused_local_var" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/struct-loc1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/struct-loc1.c new file mode 100644 index 000000000..216a498e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/struct-loc1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-g -O0 -dA -fno-merge-debug-strings" } */ + +struct foo; +struct foo *obj; +struct foo +{ + int x; +}; + +int +main () +{ + return 0; +} + +/* { dg-final { scan-assembler "DW_TAG_structure_type\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"foo\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?6\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/var1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/var1.c new file mode 100644 index 000000000..04dd12976 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/var1.c @@ -0,0 +1,10 @@ +/* PR 23190 */ +/* { dg-do compile } +/* { dg-options "-gdwarf-2 -dA -fno-merge-debug-strings" } */ +/* { dg-final { scan-assembler "xyzzy\[^\\n\\r\]+DW_AT_name" } } */ + +void f(void) +{ + static int xyzzy; + xyzzy += 3; +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/var2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/var2.c new file mode 100644 index 000000000..8ef2a7438 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/var2.c @@ -0,0 +1,14 @@ +/* PR 23190 */ +/* { dg-do compile } +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler "DW_OP_addr\[\\n\\r\]+\[^\\n\\r\]+foo" } } */ +/* { dg-final { scan-assembler "DW_OP_addr\[\\n\\r\]+\[^\\n\\r\]+bar" } } */ + +static int foo; +int bar; +int main(void) +{ + foo += 3; + bar *= 5; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/enum-1.c b/gcc/testsuite/gcc.dg/debug/enum-1.c new file mode 100644 index 000000000..7681e9b52 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/enum-1.c @@ -0,0 +1,16 @@ +/* Verify that used enums are output. */ +/* { dg-do compile } */ +/* { dg-final { scan-assembler "JTI_MAX" } } */ + +int var; + +enum java_tree_index +{ + JTI_MAX +}; + +void function (void) +{ + var = JTI_MAX; +} + diff --git a/gcc/testsuite/gcc.dg/debug/pr16676.c b/gcc/testsuite/gcc.dg/debug/pr16676.c new file mode 100644 index 000000000..a9758858f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr16676.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ + +void foo (void) { + void nested () {} +} diff --git a/gcc/testsuite/gcc.dg/debug/pr26881.c b/gcc/testsuite/gcc.dg/debug/pr26881.c new file mode 100644 index 000000000..156a2c455 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr26881.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-g -O0" } */ +int +main (int argc, char **argv) +{ + if (0) + { + static union + { + } + u; + typedef char tt; + static tt c[8]; + return c[0] == 0x01 && c[1] == 0x02; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/pr29558.c b/gcc/testsuite/gcc.dg/debug/pr29558.c new file mode 100644 index 000000000..99386b335 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr29558.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ + +void stpi_unpack_16_1(int length, unsigned char *out, unsigned char bit) +{ + unsigned char tempin; + unsigned char temp[16]; + for (bit = 128; length > 0; length--) { + if (tempin & 128) + temp[0] |= bit; + else + { + *out++ = temp[1]; + *out++ = temp[2]; + *out++ = temp[3]; + *out++ = temp[4]; + *out++ = temp[5]; + *out++ = temp[6]; + *out++ = temp[7]; + *out++ = temp[9]; + *out++ = temp[10]; + *out++ = temp[11]; + *out++ = temp[12]; + *out++ = temp[13]; + *out++ = temp[14]; + *out++ = temp[15]; + __builtin_memset (temp, 0, 16); + } + } +} + diff --git a/gcc/testsuite/gcc.dg/debug/pr29609-1.c b/gcc/testsuite/gcc.dg/debug/pr29609-1.c new file mode 100644 index 000000000..85069ebd6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr29609-1.c @@ -0,0 +1,33 @@ +/* PR debug/29609 */ +/* Verify that breakpoint on the break is hit. + This version of the test just checks that it can be compiled, linked + and executed, further testing is done in corresponding gcc.dg/dwarf2/ + test and hopefully in gdb testsuite. */ +/* { dg-do run } */ +/* { dg-options "-O0 -g -dA" } */ + +extern void abort (void); + +int +foo (void) +{ + int a, i; + + for (i = 1; i <= 10; i++) + { + if (i < 3) + a = 1; + else + break; + a = 5; + } + return a; +} + +int +main (void) +{ + if (foo () != 5) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr29609-2.c b/gcc/testsuite/gcc.dg/debug/pr29609-2.c new file mode 100644 index 000000000..1ae1a738d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr29609-2.c @@ -0,0 +1,53 @@ +/* PR debug/29609 */ +/* Verify that breakpoint on both goto failure; stmts is hit. + This version of the test just checks that it can be compiled, linked + and executed, further testing is done in corresponding gcc.dg/dwarf2/ + test and hopefully in gdb testsuite. */ +/* { dg-do run } */ +/* { dg-options "-O0 -g -dA" } */ + +extern void abort (void); +int x; + +int +foo (void) +{ + return 0 ^ x; +} + +int +bar (void) +{ + return 1 ^ x; +} + +int +baz (void) +{ + int c; + + if (!foo ()) + goto failure; + + if (!bar ()) + goto failure; + + return 0; + +failure: + return 1; +} + +int +main (void) +{ + if (baz () != 1) + abort (); + x = 1; + if (baz () != 1) + abort (); + x = 2; + if (baz () != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr32610.c b/gcc/testsuite/gcc.dg/debug/pr32610.c new file mode 100644 index 000000000..d1dae1d38 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr32610.c @@ -0,0 +1,14 @@ +/* PR debug/32610 */ +/* { dg-do compile } */ + +inline void +foo (int x) +{ + double (*arr)[x]; +} + +void +bar (void) +{ + foo (1); +} diff --git a/gcc/testsuite/gcc.dg/debug/pr33316.c b/gcc/testsuite/gcc.dg/debug/pr33316.c new file mode 100644 index 000000000..d43478bb5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr33316.c @@ -0,0 +1,15 @@ +/* PR debug/33316 */ + +int +foo (void *x, int y) +{ + const struct { int d[y]; } *a = x; + return a[0].d[0]; +} + +int +bar (void *x, int y) +{ + const struct S { int d[y]; } *a = x; + return a[0].d[0]; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr35154.c b/gcc/testsuite/gcc.dg/debug/pr35154.c new file mode 100644 index 000000000..8706c5c29 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr35154.c @@ -0,0 +1,34 @@ +/* Test to make sure that stabs for C symbols that go into .comm have the + proper structure. These should be lettered G for the struct that gives + the name to the .comm, and should be V or S for .lcomm symbols. */ + +static char i_outer; +struct { + char f1; + char f2; +} opta; +struct { + char f1; + char f2; +} optb; + +int +main() +{ + static char i_inner[2]; + i_inner[0] = 'a'; i_inner[1] = 'b'; + opta.f1 = 'c'; + opta.f2 = 'd'; + optb.f1 = 'C'; + optb.f2 = 'D'; + i_outer = 'e'; +/* { dg-do compile } */ +/* { dg-skip-if "No stabs" { mmix-*-* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* } { "*" } { "" } } */ +/* { dg-skip-if "stabs only" { *-*-* } { "*" } { "-gstabs" } } */ + return 0; +} + +/* { dg-final { scan-assembler ".stabs.*i_inner:V" } } */ +/* { dg-final { scan-assembler ".stabs.*i_outer:S" } } */ +/* { dg-final { scan-assembler ".stabs.*opta:G" } } */ +/* { dg-final { scan-assembler ".stabs.*optb:G" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/pr36690-1.c b/gcc/testsuite/gcc.dg/debug/pr36690-1.c new file mode 100644 index 000000000..e3c913b6b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr36690-1.c @@ -0,0 +1,23 @@ +/* PR debug/36690 */ +/* Verify that break func is hit. + This version of the test just checks that it can be compiled, linked + and executed, further testing is done in corresponding gcc.dg/dwarf2/ + test and hopefully in gdb testsuite. */ +/* { dg-do run } */ +/* { dg-options "-O0 -g -dA" } */ + +int i; + +void +func (void) +{ + while (i == 1) + i = 0; +} + +int +main (void) +{ + func (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr36690-2.c b/gcc/testsuite/gcc.dg/debug/pr36690-2.c new file mode 100644 index 000000000..ddda18cf7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr36690-2.c @@ -0,0 +1,40 @@ +/* PR debug/36690 */ +/* Verify that breakpoint can be put on goto f1, it is hit and + varz at that spot is defined and contains 5. Nowhere else + in the function should be varz in the scope. + This version of the test just checks that it can be compiled, linked + and executed, further testing is done in corresponding gcc.dg/dwarf2/ + test and hopefully in gdb testsuite. */ +/* { dg-do run } */ +/* { dg-options "-O0 -g -dA" } */ + +int cnt; + +void +bar (int i) +{ + cnt += i; +} + +void +foo (int i) +{ + if (!i) + bar (0); + else + { + static int varz = 5; + goto f1; + } + bar (1); +f1: + bar (2); +} + +int +main (void) +{ + foo (0); + foo (1); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr36690-3.c b/gcc/testsuite/gcc.dg/debug/pr36690-3.c new file mode 100644 index 000000000..62d3494da --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr36690-3.c @@ -0,0 +1,47 @@ +/* PR debug/36690 */ +/* { dg-do run } */ +/* { dg-options "-O0 -g -dA" } */ + +int cnt; + +void +bar (int i) +{ + cnt += i; +} + +void +foo (int i, int j) +{ + if (j) + { + bar (i + 1); + goto f1; + } + bar (i + 2); + goto f2; +f1: + if (i > 10) + goto f3; +f2: + if (i > 40) + goto f4; + else + goto f5; +f3: + bar (i); +f4: + bar (i); +f5: + bar (i); +} + +int +main (void) +{ + foo (0, 1); + foo (11, 1); + foo (21, 0); + foo (41, 0); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr37616.c b/gcc/testsuite/gcc.dg/debug/pr37616.c new file mode 100644 index 000000000..3bbaebbdf --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr37616.c @@ -0,0 +1,40 @@ +/* PR debug/37616 */ +/* Test that one can put breakpoints onto continue, exitlab and break + and actually see program reaching those breakpoints. + This version of the test just checks that it can be compiled, linked + and executed, further testing is done in corresponding gcc.dg/dwarf2/ + test and hopefully in gdb testsuite. */ +/* { dg-do run } */ +/* { dg-options "-O0 -g -dA" } */ + +extern void abort (void); + +int +foo (int parm) +{ + int varj, varm; + + for (varj = 0; varj < 10; varj++) + { + if (varj == 5) + continue; + if (varj == 7 && !parm) + goto exitlab; + if (varj == 9) + break; + varm = varj; + } + +exitlab: + return varm; +} + +int +main (void) +{ + if (foo (0) != 6) + abort (); + if (foo (1) != 8) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr39412.c b/gcc/testsuite/gcc.dg/debug/pr39412.c new file mode 100644 index 000000000..71b7b5e21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr39412.c @@ -0,0 +1,16 @@ +/* PR debug/39412 */ +/* { dg-do compile } */ + +struct S { int i; }; + +inline void +bar (const void *x, unsigned long y) +{ + const union { struct S a[y]; } *u = x; +} + +void +foo (const void *x, unsigned long y) +{ + bar (x, y); +} diff --git a/gcc/testsuite/gcc.dg/debug/pr41264-1.c b/gcc/testsuite/gcc.dg/debug/pr41264-1.c new file mode 100644 index 000000000..34bdcfe20 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr41264-1.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ + +#if (__SIZEOF_INT__ <= 2) +typedef unsigned long hashval_t; +#else +typedef unsigned int hashval_t; +#endif +static hashval_t __attribute__((always_inline)) +iterative_hash_host_wide_int (long val, hashval_t val2) +{ + hashval_t a = (hashval_t) val; + int zero = 0; + hashval_t b = (hashval_t) (val >> (sizeof (hashval_t) * 8 + zero)); + + a -= b; a -= val2; a ^= (val2>>13); + b -= val2; b -= a; b ^= (a<< 8); + val2 -= a; val2 -= b; val2 ^= ((b&0xffffffff)>>13); + a -= b; a -= val2; a ^= ((val2&0xffffffff)>>12); + b -= val2; b -= a; b = (b ^ (a<<16)) & 0xffffffff; + val2 -= a; val2 -= b; val2 = (val2 ^ (b>> 5)) & 0xffffffff; + a -= b; a -= val2; a = (a ^ (val2>> 3)) & 0xffffffff; + b -= val2; b -= a; b = (b ^ (a<<10)) & 0xffffffff; + val2 -= a; val2 -= b; val2 = (val2 ^ (b>>15)) & 0xffffffff; + return val2; +} + +hashval_t +bla (int nunits, int mode) +{ + hashval_t hashcode = 0; + + + hashcode = iterative_hash_host_wide_int (14, hashcode); + hashcode = iterative_hash_host_wide_int (nunits, hashcode); + hashcode = iterative_hash_host_wide_int (mode, hashcode); + if (nunits) + return 0; + else + return hashcode; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr41343-1.c b/gcc/testsuite/gcc.dg/debug/pr41343-1.c new file mode 100644 index 000000000..6d5638038 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr41343-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +#define X(new,old) int i ## new = i ## old + i ## old; +#define Y(pfx) X(pfx ## 1, pfx) \ + X(pfx ## 2, pfx ## 1) \ + X(pfx ## 3, pfx ## 2) \ + X(pfx ## 4, pfx ## 3) \ + X(pfx ## 5, pfx ## 4) \ + X(pfx ## 6, pfx ## 5) \ + X(pfx ## 7, pfx ## 6) \ + X(pfx ## 8, pfx ## 7) \ + X(pfx ## 9, pfx ## 8) + +void foo (int i1) +{ + Y(1) + Y(11) + Y(111) + asm ("" : : "X" (i1)); +} diff --git a/gcc/testsuite/gcc.dg/debug/pr41717.c b/gcc/testsuite/gcc.dg/debug/pr41717.c new file mode 100644 index 000000000..21250883a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr41717.c @@ -0,0 +1,10 @@ +/* PR debug/41717 */ +/* { dg-do compile } */ + +void +foo (void) +{ + _Complex float v[1], w; + v[1] = 0.0f + 0.8fi; + w = __builtin_conjf (v[1] * v[1]); +} diff --git a/gcc/testsuite/gcc.dg/debug/pr41893-1.c b/gcc/testsuite/gcc.dg/debug/pr41893-1.c new file mode 100644 index 000000000..6da30708e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr41893-1.c @@ -0,0 +1,16 @@ +/* PR debug/41893 */ +/* { dg-do link } */ +/* { dg-require-effective-target lto } */ +/* { dg-options "-flto -fwhole-program -O" } */ +/* { dg-additional-sources "pr41893-2.c" } */ + +struct S { int v; }; +struct S s; + +void __attribute__((externally_visible)) +func1 (void) +{ + struct S *p = &s; +} + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/debug/pr41893-2.c b/gcc/testsuite/gcc.dg/debug/pr41893-2.c new file mode 100644 index 000000000..f967875f1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr41893-2.c @@ -0,0 +1,10 @@ +/* PR debug/41893 */ +/* { dg-do compile } */ + +extern struct S s; + +void +func2 (void) +{ + &s; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr42244.c b/gcc/testsuite/gcc.dg/debug/pr42244.c new file mode 100644 index 000000000..ff2542873 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr42244.c @@ -0,0 +1,13 @@ +/* PR debug/42444 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g -fmodulo-sched -ffloat-store" } */ + +extern int a, b; + +double +foo (double x) +{ + for (; a > b; a--) + x *= (double) a; + return x; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr42767.c b/gcc/testsuite/gcc.dg/debug/pr42767.c new file mode 100644 index 000000000..1f0e25fe5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr42767.c @@ -0,0 +1,18 @@ +/* PR debug/42767 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -g" } */ + +struct lineno_cache_entry +{ + unsigned long size; +}; +_bfd_link_section_stabs (struct lineno_cache_entry * stabsec) +{ + unsigned long count; + unsigned char *sym; + unsigned char *symend; + unsigned long skip; + count = stabsec->size / 12; + for (; sym < symend; sym += 1); + stabsec->size = (count - skip) * 12; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr43972.c b/gcc/testsuite/gcc.dg/debug/pr43972.c new file mode 100644 index 000000000..5fcf1e0e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr43972.c @@ -0,0 +1,29 @@ +/* PR debug/43972 */ +/* { dg-do compile } */ +/* { dg-options "-g -w" } */ +/* { dg-options "-g -fpic -w" { target fpic } } */ + +struct { int *b1; } *f1 (); +short v1[1]; +struct S { int b2; }; +void +foo (struct S *a1, union { char *b3; unsigned *b4; int *b5; } *a2) +{ + int d; + switch (d) + { + case 0: + { + int c = a1->b2, i; + if (f1 () == 0) + *a2->b3++ = 2; + else if (((long) (f1 () - f1 ())) ^ ((long) f1 ()->b1 - ((long) f1 () & 8))) + *a2->b3++ = (long) f1 - ((long) f1 () & 0xff); + else + *a2->b4++ = (long) f1; + for (i = 0; i < c; i++) + *a2->b5++ = (long) v1; + foo (a1, a2); + } + } +} diff --git a/gcc/testsuite/gcc.dg/debug/pr45849.c b/gcc/testsuite/gcc.dg/debug/pr45849.c new file mode 100644 index 000000000..93279b708 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr45849.c @@ -0,0 +1,31 @@ +/* PR debug/45849 */ +/* { dg-do compile } */ +/* { dg-options "-g -Wno-uninitialized" } */ + +extern void bar (void); + +void +foo (long repllen, char *rp) +{ + char *matchend; + char *scan; + long len; + char *matchstart; + char *text; + char *t; + + repllen--; + + for (;;) + { + matchstart = t + rp[0]; + matchend = rp; + len = matchstart - text + repllen * (matchend - matchstart); + while (len) + ; + for (scan = text; scan != rp; scan++) + bar (); + if (matchstart) + text = matchend; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/pr46409.c b/gcc/testsuite/gcc.dg/debug/pr46409.c new file mode 100644 index 000000000..066cb67ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr46409.c @@ -0,0 +1,9 @@ +/* PR debug/46409 */ +/* { dg-options "-g" } */ + +int +foo (int (*x) (unsigned long long), unsigned long long y) +{ + unsigned int z = x (y); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr46782.c b/gcc/testsuite/gcc.dg/debug/pr46782.c new file mode 100644 index 000000000..1603b0922 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr46782.c @@ -0,0 +1,11 @@ +/* PR debug/46782 */ +/* { dg-do compile } */ +/* { dg-options "-w -O0 -fvar-tracking -fcompare-debug" } */ + +void foo (int i) +{ + if (i) + i++; + while (i) + ; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr47498.c b/gcc/testsuite/gcc.dg/debug/pr47498.c new file mode 100644 index 000000000..6bf1484cf --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr47498.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fsched2-use-superblocks -fcompare-debug" } */ + +int bar(void *); + +void foo (void *p) +{ + int i = 1; + while (i) + i = bar (p); +} diff --git a/gcc/testsuite/gcc.dg/debug/pr47501.c b/gcc/testsuite/gcc.dg/debug/pr47501.c new file mode 100644 index 000000000..3bfb5acc7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr47501.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -fmodulo-sched -fcompare-debug" } */ + +void +foo (void) +{ + unsigned numlen; + unsigned foldlen; + for (; foldlen; foldlen -= numlen) + foo (); +} diff --git a/gcc/testsuite/gcc.dg/debug/pr49032.c b/gcc/testsuite/gcc.dg/debug/pr49032.c new file mode 100644 index 000000000..3985040d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr49032.c @@ -0,0 +1,11 @@ +/* PR debug/49032 */ +/* { dg-do link } */ + +static int s = 42; + +int +main () +{ + int *l[18] = { &s, &s, &s, &s, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/pr49522.c b/gcc/testsuite/gcc.dg/debug/pr49522.c new file mode 100644 index 000000000..3fa3bfb0e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr49522.c @@ -0,0 +1,41 @@ +/* PR debug/49522 */ +/* { dg-do compile } */ +/* { dg-options "-fcompare-debug" } */ + +int val1 = 0L; +volatile int val2 = 7L; +long long val3; +int *ptr = &val1; + +static int +func1 () +{ + return 0; +} + +static short int +func2 (short int a, unsigned int b) +{ + return !b ? a : a >> b; +} + +static unsigned long long +func3 (unsigned long long a, unsigned long long b) +{ + return !b ? a : a % b; +} + +void +func4 (unsigned short arg1, int arg2) +{ + for (arg2 = 0; arg2 < 2; arg2++) + { + *ptr = func3 (func3 (10, func2 (val3, val2)), val3); + for (arg1 = -14; arg1 > 14; arg1 = func1 ()) + { + *ptr = -1; + if (foo ()) + ; + } + } +} diff --git a/gcc/testsuite/gcc.dg/debug/redecl-1.c b/gcc/testsuite/gcc.dg/debug/redecl-1.c new file mode 100644 index 000000000..14a453e04 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/redecl-1.c @@ -0,0 +1,352 @@ +/* Test for multiple declarations and composite types. As in bug + 13801. Test no problems in debug information generation. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef int IA[]; +typedef int A10[10]; + +/* Test all combinations of: a variable declared at file scope (no + type specifiers, or extern, or static), or just inside a function + (with extern), redeclared in an inner scope (with extern), and + redeclared in an inner scope when the previous declaration is + hidden (with extern, and not if the original declaration was + static). Test three times: incomplete variable types; pointers to + incomplete types; functions returning such pointers. + + This test only includes the valid code cases, to test debug info + generation. (Incomplete static at file scope is not permitted by + ISO C, but is accepted by GCC as an extension without + -pedantic.) */ + +A10 a5; +void +f5 (void) +{ + sizeof(a5); + { + extern IA a5; + sizeof(a5); + { + int a5; + { + extern A10 a5; + sizeof(a5); + } + } + sizeof(a5); + } + sizeof(a5); +} +extern A10 a5; + +A10 a7; +void +f7 (void) +{ + sizeof(a7); + { + extern A10 a7; + sizeof(a7); + { + int a7; + { + extern A10 a7; + sizeof(a7); + } + } + sizeof(a7); + } + sizeof(a7); +} +extern A10 a7; + +extern A10 a13; +void +f13 (void) +{ + sizeof(a13); + { + extern IA a13; + sizeof(a13); + { + int a13; + { + extern A10 a13; + sizeof(a13); + } + } + sizeof(a13); + } + sizeof(a13); +} +extern A10 a13; + +extern A10 a15; +void +f15 (void) +{ + sizeof(a15); + { + extern A10 a15; + sizeof(a15); + { + int a15; + { + extern A10 a15; + sizeof(a15); + } + } + sizeof(a15); + } + sizeof(a15); +} +extern A10 a15; + + +static A10 a18; +void +f18 (void) +{ + sizeof(a18); + { + extern IA a18; + sizeof(a18); + } + sizeof(a18); +} +extern A10 a18; + +static A10 a19; +void +f19 (void) +{ + sizeof(a19); + { + extern A10 a19; + sizeof(a19); + } + sizeof(a19); +} +extern A10 a19; + +A10 *b5; +void +g5 (void) +{ + sizeof(*b5); + { + extern IA *b5; + sizeof(*b5); + { + int b5; + { + extern A10 *b5; + sizeof(*b5); + } + } + sizeof(*b5); + } + sizeof(*b5); +} +extern A10 *b5; + +A10 *b7; +void +g7 (void) +{ + sizeof(*b7); + { + extern A10 *b7; + sizeof(*b7); + { + int b7; + { + extern A10 *b7; + sizeof(*b7); + } + } + sizeof(*b7); + } + sizeof(*b7); +} +extern A10 *b7; + +extern A10 *b13; +void +g13 (void) +{ + sizeof(*b13); + { + extern IA *b13; + sizeof(*b13); + { + int b13; + { + extern A10 *b13; + sizeof(*b13); + } + } + sizeof(*b13); + } + sizeof(*b13); +} +extern A10 *b13; + +extern A10 *b15; +void +g15 (void) +{ + sizeof(*b15); + { + extern A10 *b15; + sizeof(*b15); + { + int b15; + { + extern A10 *b15; + sizeof(*b15); + } + } + sizeof(*b15); + } + sizeof(*b15); +} +extern A10 *b15; + +static A10 *b18; +void +g18 (void) +{ + sizeof(*b18); + { + extern IA *b18; + sizeof(*b18); + } + sizeof(*b18); +} +extern A10 *b18; + +static A10 *b19; +void +g19 (void) +{ + sizeof(*b19); + { + extern A10 *b19; + sizeof(*b19); + } + sizeof(*b19); +} +extern A10 *b19; + +A10 *c5 (void); +void +h5 (void) +{ + sizeof(*c5()); + { + extern IA *c5 (void); + sizeof(*c5()); + { + int c5; + { + extern A10 *c5 (void); + sizeof(*c5()); + } + } + sizeof(*c5()); + } + sizeof(*c5()); +} +A10 *c5 (void) { return 0; } + +A10 *c7 (void); +void +h7 (void) +{ + sizeof(*c7()); + { + extern A10 *c7 (void); + sizeof(*c7()); + { + int c7; + { + extern A10 *c7 (void); + sizeof(*c7()); + } + } + sizeof(*c7()); + } + sizeof(*c7()); +} +A10 *c7 (void) { return 0; } + +extern A10 *c13 (void); +void +h13 (void) +{ + sizeof(*c13()); + { + extern IA *c13 (void); + sizeof(*c13()); + { + int c13; + { + extern A10 *c13 (void); + sizeof(*c13()); + } + } + sizeof(*c13()); + } + sizeof(*c13()); +} +extern A10 *c13 (void) { return 0; } + +extern A10 *c15 (void); +void +h15 (void) +{ + sizeof(*c15()); + { + extern A10 *c15 (void); + sizeof(*c15()); + { + int c15; + { + extern A10 *c15 (void); + sizeof(*c15()); + } + } + sizeof(*c15()); + } + sizeof(*c15()); +} +extern A10 *c15 (void) { return 0; } + +static A10 *c18 (void); +void +h18 (void) +{ + sizeof(*c18()); + { + extern IA *c18 (void); + sizeof(*c18()); + } + sizeof(*c18()); +} +static A10 *c18 (void) { return 0; } + +static A10 *c19 (void); +void +h19 (void) +{ + sizeof(*c19()); + { + extern A10 *c19 (void); + sizeof(*c19()); + } + sizeof(*c19()); +} +static A10 *c19 (void) { return 0; } diff --git a/gcc/testsuite/gcc.dg/debug/redecl-2.c b/gcc/testsuite/gcc.dg/debug/redecl-2.c new file mode 100644 index 000000000..2bf661fdc --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/redecl-2.c @@ -0,0 +1,24 @@ +/* Test for multiple declarations and composite types. As in bug + 13801. Illustrates how bug causes correct code to be wrongly + diagnosed. Debug test: avoid ICE. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef int IA[]; +typedef int A5[5]; +typedef int A10[10]; + +A10 array10; + +A5 *ap; +void +f (void) +{ + int ap; + { + extern IA *ap; + /* This assignment is valid. */ + ap = &array10; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/redecl-3.c b/gcc/testsuite/gcc.dg/debug/redecl-3.c new file mode 100644 index 000000000..3f0c053a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/redecl-3.c @@ -0,0 +1,12 @@ +/* Test for multiple declarations and composite types. */ + +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int y[]; +void +g (void) +{ + extern int y[1]; +} diff --git a/gcc/testsuite/gcc.dg/debug/redecl-4.c b/gcc/testsuite/gcc.dg/debug/redecl-4.c new file mode 100644 index 000000000..aac4ee7d4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/redecl-4.c @@ -0,0 +1,12 @@ +/* Test for multiple declarations and composite types. */ + +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +static int y[]; +void +g (void) +{ + extern int y[1]; +} diff --git a/gcc/testsuite/gcc.dg/debug/redecl-5.c b/gcc/testsuite/gcc.dg/debug/redecl-5.c new file mode 100644 index 000000000..b915b3fdf --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/redecl-5.c @@ -0,0 +1,31 @@ +/* Test for multiple declarations and composite types, as in bug + 13801. Test types saved from outer scopes are up to date. Debug + test. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int x[]; + +void +f (void) +{ + extern int x[]; +} + +int x[10]; + +void +g (void) +{ + int x; + { + extern int x[10]; + } +} + +void +h (void) +{ + sizeof (x); +} diff --git a/gcc/testsuite/gcc.dg/debug/tls-1.c b/gcc/testsuite/gcc.dg/debug/tls-1.c new file mode 100644 index 000000000..a9431ef00 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/tls-1.c @@ -0,0 +1,19 @@ +/* Test that optimized out __thread var doesn't have its location + referenced in debug info. */ +/* { dg-do link } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ + +static __thread int vara; + +int +foo (int b) +{ + return vara + b; +} + +int +main (void) +{ + return foo (0); +} diff --git a/gcc/testsuite/gcc.dg/debug/trivial.c b/gcc/testsuite/gcc.dg/debug/trivial.c new file mode 100644 index 000000000..5b125eca9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/trivial.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ + +int main(void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/vta-1.c b/gcc/testsuite/gcc.dg/debug/vta-1.c new file mode 100644 index 000000000..414083a09 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/vta-1.c @@ -0,0 +1,34 @@ +/* https://bugzilla.redhat.com/show_bug.cgi?id=521991#c5 + + Distilled from Linux XFS source code. foo, inlined into bar, ends + up with debug stmts referencing the addressable variable b. + Optimization made it non-addressable, and then completely optimized + away, before we got a chance to rename (and discard) the occurrence + in the debug stmt. When we did, we crashed, attempting to rename + an unreference variable. */ + +/* { dg-do compile } */ + +static inline int +foo (void *x, unsigned y) +{ + unsigned z = *(unsigned long *) x % y; + *(unsigned long *) x = *(unsigned long *) x / y; + return z; +} + +struct S +{ + unsigned t; +}; + +void +bar (struct S *x, int *y) +{ + int a = 0; + unsigned long b = x->t; + foo (&b, x->t); + for (;; a++) + if (b) + *y = 1; +} diff --git a/gcc/testsuite/gcc.dg/debug/vta-2.c b/gcc/testsuite/gcc.dg/debug/vta-2.c new file mode 100644 index 000000000..5d44262ec --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/vta-2.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +static int +bar (void *a, unsigned int b, int n) +{ + int c = *(unsigned long *) a % b; + *(unsigned long *) a = (int) (*(unsigned long *) a) / b; + return c; +} + +int +foo (unsigned long x, int *y, int z) +{ + int level; + for (level = 0; level < *y; level++) + { + bar (&x, z, sizeof (x)); + if (x) + return *y - 1; + } +} diff --git a/gcc/testsuite/gcc.dg/debug/vta-3.c b/gcc/testsuite/gcc.dg/debug/vta-3.c new file mode 100644 index 000000000..7d014f1bc --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/vta-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +int +foo (void) +{ + union { char e[8]; int i; } a, b; + char *c, *d; + unsigned int i; + c = a.e; + d = &b.e[sizeof (int) - 1]; + for (i = 0; i < sizeof (int); i++) + { + *d = *c++; + --d; + } + return b.i; +} |