diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-04-22 10:21:45 +0000 |
---|---|---|
committer | <> | 2015-04-25 21:44:09 +0000 |
commit | f80b5ea1605c9f9408c5aa386ba71c16d918ebbf (patch) | |
tree | bb7eafaa81fc4b8c5c215bc08d517fd158db234a /gcc/testsuite/gcc.misc-tests | |
parent | c27a97d04853380f1e80525391b3f0d156ed4c84 (diff) | |
download | gcc-tarball-f80b5ea1605c9f9408c5aa386ba71c16d918ebbf.tar.gz |
Imported from /home/lorry/working-area/delta_gcc-tarball/gcc-5.1.0.tar.bz2.gcc-5.1.0
Diffstat (limited to 'gcc/testsuite/gcc.misc-tests')
20 files changed, 1146 insertions, 25 deletions
diff --git a/gcc/testsuite/gcc.misc-tests/acker1.exp b/gcc/testsuite/gcc.misc-tests/acker1.exp index ca035a8f80..5cc36cebd6 100644 --- a/gcc/testsuite/gcc.misc-tests/acker1.exp +++ b/gcc/testsuite/gcc.misc-tests/acker1.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2015 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 @@ -20,9 +20,21 @@ if { ![info exists PERF_TEST] || "$PERF_TEST" != "yes" } { } load_lib mike-gcc.exp +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p acker1] { + return +} +gcc_parallel_test_enable 0 prebase set actions run set compiler_output "^$" set program_output "^$" postbase acker1.c $run $groups + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/arm-isr.exp b/gcc/testsuite/gcc.misc-tests/arm-isr.exp index 6685e67e3e..7505588668 100644 --- a/gcc/testsuite/gcc.misc-tests/arm-isr.exp +++ b/gcc/testsuite/gcc.misc-tests/arm-isr.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2015 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 diff --git a/gcc/testsuite/gcc.misc-tests/bprob.exp b/gcc/testsuite/gcc.misc-tests/bprob.exp index 6c0c068ebe..2a8d851e19 100644 --- a/gcc/testsuite/gcc.misc-tests/bprob.exp +++ b/gcc/testsuite/gcc.misc-tests/bprob.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2015 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 diff --git a/gcc/testsuite/gcc.misc-tests/dectest.exp b/gcc/testsuite/gcc.misc-tests/dectest.exp index 56734cc7eb..75f52b20d7 100644 --- a/gcc/testsuite/gcc.misc-tests/dectest.exp +++ b/gcc/testsuite/gcc.misc-tests/dectest.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2005-2014 Free Software Foundation, Inc. +# Copyright (C) 2005-2015 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 diff --git a/gcc/testsuite/gcc.misc-tests/dhry.exp b/gcc/testsuite/gcc.misc-tests/dhry.exp index f698d6ba85..691a7e9694 100644 --- a/gcc/testsuite/gcc.misc-tests/dhry.exp +++ b/gcc/testsuite/gcc.misc-tests/dhry.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2015 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 @@ -20,9 +20,21 @@ if { ![info exists PERF_TEST] || "$PERF_TEST" != "yes" } { } load_lib mike-gcc.exp +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p dhry] { + return +} +gcc_parallel_test_enable 0 prebase set actions run set compiler_output "^$" set program_output "^$" postbase dhry.c $run $groups + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/gcov-14.c b/gcc/testsuite/gcc.misc-tests/gcov-14.c index de7ac0d2ab..78dd7bedd7 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-14.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-14.c @@ -1,6 +1,6 @@ /* Test gcov extern inline. */ -/* { dg-options "-O2 -fprofile-arcs -ftest-coverage" } */ +/* { dg-options "-O2 -fprofile-arcs -ftest-coverage -fgnu89-inline" } */ /* The following line arranges that Darwin has behavior like elf weak import. */ /* { dg-additional-options "-flat_namespace -undefined suppress" { target *-*-darwin* } } */ /* { dg-require-weak "" } */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov-16.c b/gcc/testsuite/gcc.misc-tests/gcov-16.c new file mode 100644 index 0000000000..738113c92c --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/gcov-16.c @@ -0,0 +1,24 @@ +/* { dg-options "-fprofile-arcs -ftest-coverage" } */ +/* { dg-do run { target native } } */ + +void +bar (void) +{} + +void +foo (int i) +{ + if (i > 1) /* count(1) */ + return; /* count(#####) */ + + bar (); /* count(1) */ +} + +int +main (void) +{ + foo (0); + return 0; +} + +/* { dg-final { run-gcov gcov-16.c } } */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp index 8132e7cdc8..d496a8f503 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov.exp +++ b/gcc/testsuite/gcc.misc-tests/gcov.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2015 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 diff --git a/gcc/testsuite/gcc.misc-tests/godump-1.c b/gcc/testsuite/gcc.misc-tests/godump-1.c new file mode 100644 index 0000000000..86bdf23889 --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/godump-1.c @@ -0,0 +1,875 @@ +/* Test -fdump-go-specs option. */ + +/* { dg-options "-c -fdump-go-spec=godump-1.out" } */ +/* { dg-do compile } */ +/* { dg-skip-if "not supported for target" { ! "alpha*-*-* s390*-*-* i?86-*-* x86_64-*-*" } } */ +/* { dg-skip-if "not supported for target" { ! lp64 } } */ + +#include <stdint.h> + +/* Necessary quoting in the regexp patters: + + (?n) at beginning of pattern to make ^ and $ work. + " -> \" + *, + -> "*", "+" + [, ] -> "\[", "\]" + (, ) -> "\[(\]", "\[)\]" + {, } -> "\{", "\}" +*/ + +/*** integer based types ***/ +typedef char c_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _c_t u?int8$" } } */ + +char c_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _c_v1 u?int\[0-9\]*$" } } */ + +c_t c_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _c_v2 _c_t$" } } */ + +typedef short s_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _s_t int\[0-9\]*$" } } */ + +short s_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _s_v1 int\[0-9\]*$" } } */ + +s_t s_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _s_v2 _s_t$" } } */ + +typedef int i_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i_t int\[0-9\]*$" } } */ + +int i_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _i_v1 int\[0-9\]*$" } } */ + +i_t i_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _i_v2 _i_t$" } } */ + +typedef long l_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _l_t int\[0-9\]*$" } } */ + +long l_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _l_v1 int\[0-9\]*$" } } */ + +l_t l_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _l_v2 _l_t$" } } */ + +typedef long long ll_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ll_t int\[0-9\]*$" } } */ + +long long ll_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _ll_v1 int\[0-9\]*$" } } */ + +ll_t ll_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ll_v2 _ll_t$" } } */ + +typedef unsigned char uc_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _uc_t uint8$" } } */ + +unsigned char uc_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _uc_v1 uint\[0-9\]*$" } } */ + +uc_t uc_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _uc_v2 _uc_t$" } } */ + +typedef unsigned short us_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _us_t uint\[0-9\]*$" } } */ + +unsigned short us_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _us_v1 uint\[0-9\]*$" } } */ + +us_t us_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _us_v2 _us_t$" } } */ + +typedef unsigned int ui_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ui_t uint\[0-9\]*$" } } */ + +unsigned int ui_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _ui_v1 uint\[0-9\]*$" } } */ + +ui_t ui_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ui_v2 _ui_t$" } } */ + +typedef unsigned long ul_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ul_t uint\[0-9\]*$" } } */ + +unsigned long ul_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _ul_v1 uint\[0-9\]*$" } } */ + +ul_t ul_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ul_v2 _ul_t$" } } */ + +typedef unsigned long long ull_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ull_t uint\[0-9\]*$" } } */ + +unsigned long long ull_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _ull_v1 uint\[0-9\]*$" } } */ + +ull_t ull_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ull_v2 _ull_t$" } } */ + +typedef signed char sc_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _sc_t int8$" } } */ + +signed char sc_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sc_v1 int\[0-9\]*$" } } */ + +sc_t sc_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sc_v2 _sc_t$" } } */ + +typedef signed short ss_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ss_t int\[0-9\]*$" } } */ + +signed short ss_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _ss_v1 int\[0-9\]*$" } } */ + +ss_t ss_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ss_v2 _ss_t$" } } */ + +typedef signed int si_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _si_t int\[0-9\]*$" } } */ + +signed int si_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _si_v1 int\[0-9\]*$" } } */ + +si_t si_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _si_v2 _si_t$" } } */ + +typedef signed long sl_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _sl_t int\[0-9\]*$" } } */ + +signed long sl_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sl_v1 int\[0-9\]*$" } } */ + +sl_t sl_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sl_v2 _sl_t$" } } */ + +typedef signed long long sll_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _sll_t int\[0-9\]*$" } } */ + +signed long long sll_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sll_v1 int\[0-9\]*$" } } */ + +sll_t sll_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sll_v2 _sll_t$" } } */ + +typedef int8_t i8_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i8_t int8$" } } */ + +int8_t i8_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _i8_v1 _int8_t$" } } */ + +i8_t i8_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _i8_v2 _i8_t$" } } */ + +typedef int16_t i16_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i16_t int16$" } } */ + +int16_t i16_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _i16_v1 _int16_t$" } } */ + +i16_t i16_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _i16_v2 _i16_t$" } } */ + +typedef int32_t i32_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i32_t int32$" } } */ + +int32_t i32_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _i32_v1 _int32_t$" } } */ + +i32_t i32_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _i32_v2 _i32_t$" } } */ + +typedef int64_t i64_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i64_t int64$" } } */ + +int64_t i64_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _i64_v1 _int64_t$" } } */ + +i64_t i64_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _i64_v2 _i64_t$" } } */ + +typedef uint8_t ui8_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ui8_t uint8$" } } */ + +uint8_t ui8_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _ui8_v1 _uint8_t$" } } */ + +ui8_t ui8_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ui8_v2 _ui8_t$" } } */ + +typedef uint16_t iu16_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _iu16_t uint16$" } } */ + +uint16_t iu16_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _iu16_v1 _uint16_t$" } } */ + +iu16_t iu16_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _iu16_v2 _iu16_t$" } } */ + +typedef uint32_t iu32_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _iu32_t uint32$" } } */ + +uint32_t iu32_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _iu32_v1 _uint32_t$" } } */ + +iu32_t iu32_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _iu32_v2 _iu32_t$" } } */ + +typedef uint64_t iu64_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _iu64_t uint64$" } } */ + +uint64_t iu64_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _iu64_v1 _uint64_t$" } } */ + +iu64_t iu64_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _iu64_v2 _iu64_t$" } } */ + +typedef const char cc_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _cc_t u?int8$" } } */ + +const char cc_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _cc_v1 u?int8$" } } */ + +cc_t cc_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _cc_v2 _cc_t$" } } */ + + +/*** pointer and array types ***/ +typedef void *vp_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _vp_t \\*byte$" } } */ + +void *vp_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _vp_v1 \\*byte$" } } */ + +vp_t vp_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _vp_v2 _vp_t$" } } */ + +typedef int **ipp_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ipp_t \\*\\*int\[0-9\]*$" } } */ + +int **ipp_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _ipp_v1 \\*\\*int\[0-9\]*$" } } */ + +ipp_t ipp_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ipp_v2 _ipp_t$" } } */ + +typedef char ca_t[]; +/* { dg-final { scan-file godump-1.out "(?n)^type _ca_t \\\[0\\\]u?int8$" } } */ + +char ca_v1[]; /* { dg-warning "array 'ca_v1' assumed to have one element" } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1 \\\[0\\+1\\\]u?int8$" } } */ + +char ca_v1b[2]; +/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1b \\\[1\\+1\\\]u?int8$" } } */ + +ca_t ca_v2; /* { dg-warning "array 'ca_v2' assumed to have one element" } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v2 \\\[0\\+1\\\]u?int8$" } } */ + +typedef short sa2_t[2]; +/* { dg-final { scan-file godump-1.out "(?n)^type _sa2_t \\\[1\\+1\\\]int\[0-9\]*$" } } */ + +short sa2_v1[2]; +/* { dg-final { scan-file godump-1.out "(?n)^var _sa2_v1 \\\[1\\+1\\\]int\[0-9\]*$" } } */ + +sa2_t sa2_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sa2_v2 _sa2_t$" } } */ + + +/*** floating point types ***/ +typedef float f_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _f_t float\[0-9\]*$" } } */ + +float f_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _f_v1 float\[0-9\]*$" } } */ + +f_t f_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _f_v2 _f_t$" } } */ + +typedef double d_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _d_t float\[0-9\]*$" } } */ + +double d_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _d_v1 float\[0-9\]*$" } } */ + +d_t d_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _d_v2 _d_t$" } } */ + +typedef long double ld_t; +/* { dg-final { scan-file godump-1.out "(?n)^// type _ld_t INVALID-float-\[0-9\]*$" } } */ + +long double ld_v1; +/* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v1 INVALID-float-\[0-9\]*$" } } */ + +ld_t ld_v2; +/* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v2 INVALID-float-\[0-9\]*$" } } */ + +/*** complex types ***/ +typedef _Complex cx_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _cx_t complex\[0-9\]*$" } } */ + +_Complex cx_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _cx_v1 complex\[0-9\]*$" } } */ + +cx_t cx_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _cx_v2 _cx_t$" } } */ + +typedef float _Complex fcx_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _fcx_t complex\[0-9\]*$" } } */ + +float _Complex fcx_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _fcx_v1 complex\[0-9\]*$" } } */ + +fcx_t fcx_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _fcx_v2 _fcx_t$" } } */ + +typedef double _Complex dcx_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _dcx_t complex\[0-9\]*$" } } */ + +double _Complex dcx_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _dcx_v1 complex\[0-9\]*$" } } */ + +dcx_t dcx_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _dcx_v2 _dcx_t$" } } */ + +typedef long double _Complex ldcx_t; +/* { dg-final { scan-file godump-1.out "(?n)^// type _ldcx_t INVALID-complex-\[0-9\]*$" } } */ + +long double _Complex ldcx_v1; +/* { dg-final { scan-file godump-1.out "(?n)^// var _ldcx_v1 INVALID-complex-\[0-9\]*$" } } */ + +ldcx_t ldcx_v2; +/* { dg-final { scan-file godump-1.out "(?n)^// var _ldcx_v2 INVALID-complex-\[0-9\]*$" } } */ + +typedef int _Complex icx_t; +/* { dg-final { scan-file godump-1.out "(?n)^// type _icx_t INVALID-complex-non-real$" } } */ + +int _Complex icx_v1; +/* { dg-final { scan-file godump-1.out "(?n)^// var _icx_v1 INVALID-complex-non-real$" } } */ + +icx_t icx_v2; +/* { dg-final { scan-file godump-1.out "(?n)^// var _icx_v2 INVALID-complex-non-real$" } } */ + + +/*** nested typedefs ***/ +typedef int32_t ni_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ni_t int32$" } } */ + +typedef ni_t ni2_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ni2_t int32$" } } */ + +ni2_t ni2_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ni2_v2 _ni2_t$" } } */ + +typedef ni2_t ni3_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ni3_t int32$" } } */ + +ni3_t ni3_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _ni3_v2 _ni3_t$" } } */ + + +/*** enums ***/ +enum { E11 }; +/* { dg-final { scan-file godump-1.out "(?n)^const _E11 = 0$" } } */ + +enum { EV11 } e1_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _e1_v1 int$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EV11 = 0$" } } */ + +enum { E21, E22 }; +/* { dg-final { scan-file godump-1.out "(?n)^const _E21 = 0$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _E22 = 1$" } } */ + +enum { EV21, EV22 } e2_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _e2_v1 int$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EV21 = 0$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EV22 = 1$" } } */ + +enum { EN1 = 3, EN2 = 77, EN3 = -1, EN4 }; +/* { dg-final { scan-file godump-1.out "(?n)^const _EN1 = 3$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EN2 = 77$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EN3 = -1$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EN4 = 0$" } } */ + +typedef enum { ET1, ET2 } et_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _et_t int$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _ET1 = 0$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _ET2 = 1$" } } */ + +enum { ETV1, ETV2 } et_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _et_v1 int$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _ETV1 = 0$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _ETV2 = 1$" } } */ + +et_t et_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _et_v2 _et_t$" } } */ + + +/*** simple structs ***/ +typedef struct { } ts0e; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts0e struct \{ \}$" } } */ + +struct { } s0e; +/* { dg-final { scan-file godump-1.out "(?n)^var _s0e struct \{ \}$" } } */ + +typedef struct { int8_t e1; } ts1e; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts1e struct \{ e1 int8; \}$" } } */ + +struct { int8_t e1; } s1e; +/* { dg-final { scan-file godump-1.out "(?n)^var _s1e struct \{ e1 int8; \}$" } } */ + +typedef struct { int8_t e1; void *e2; } ts2el; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts2el struct \{ e1 int8; e2 \\*byte; \}$" } } */ + +struct { int8_t e1; void *e2; } s2el; +/* { dg-final { scan-file godump-1.out "(?n)^var _s2el struct \{ e1 int8; e2 \\*byte; \}$" } } */ + +typedef struct { void *e1; int8_t e2; } ts2eg; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts2eg struct \{ e1 \\*byte; e2 int8; \}$" } } */ + +struct { void *e1; int8_t e2; } s2eg; +/* { dg-final { scan-file godump-1.out "(?n)^var _s2eg struct \{ e1 \\*byte; e2 int8; \}$" } } */ + +typedef struct { int64_t l; int8_t c; int32_t i; int16_t s; } tsme; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsme struct \{ l int64; c int8; i int32; s int16; \}$" } } */ + +struct { int64_t l; int8_t c; int32_t i; int16_t s; } sme; +/* { dg-final { scan-file godump-1.out "(?n)^var _sme struct \{ l int64; c int\8; i int32; s int16; \}$" } } */ + +typedef struct { int16_t sa[3]; int8_t ca[3]; } tsae; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsae struct \{ sa \\\[2\\+1\\\]int16; ca \\\[2\\+1\\\]int8; \}$" } } */ + +struct { int16_t sa[3]; int8_t ca[3]; } sae; +/* { dg-final { scan-file godump-1.out "(?n)^var _sae struct \{ sa \\\[2\\+1\\\]int16; ca \\\[2\\+1\\\]int8; \}$" } } */ + +typedef struct { float f; } tsf_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_equiv struct \{ f float\[0-9\]*; \}$" } } */ + +struct { float f; } sf_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^var _sf_equiv struct \{ f float\[0-9\]*; \}$" } } */ + +typedef struct { float f; uint8_t : 0; } tsf_not_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */ + +struct { float f; uint8_t : 0; } sf_not_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^var _sf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */ + +typedef struct { double d; } tsd_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_equiv struct \{ d float\[0-9\]*; \}$" } } */ + +struct { double d; } sd_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^var _sd_equiv struct \{ d float\[0-9\]*; \}$" } } */ + +typedef struct { double d; uint8_t : 0; } tsd_not_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */ + +struct { double d; uint8_t : 0; } sd_not_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^var _sd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */ + +typedef struct s_undef_t s_undef_t2; + + +/*** nested structs ***/ +typedef struct { struct { uint8_t ca[3]; } s; uint32_t i; } tsn; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsn struct \{ s struct \{ ca \\\[2\\+1\\\]uint8; \}; i uint32; \}$" } } */ + +struct { struct { uint8_t ca[3]; } s; uint32_t i; } sn; +/* { dg-final { scan-file godump-1.out "(?n)^var _sn struct \{ s struct \{ ca \\\[2\\+1\\\]uint8; \}; i uint32; \}$" } } */ + +typedef struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } tsn_anon; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_align \\\[0\\\]int16; \}$" } } */ + +struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } sn_anon; +/* { dg-final { scan-file godump-1.out "(?n)^var _sn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_align \\\[0\\\]int16; \}$" } } */ + + +/*** structs with bitfields ***/ +typedef struct { uint8_t : 0; uint8_t c; } tsbf_anon_pad1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad1 struct \{ c uint8; \}$" } } */ + +struct { uint8_t : 0; uint8_t c; } sbf_anon_pad1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad1 struct \{ c uint8; \}$" } } */ + +typedef struct { uint8_t : 1; uint8_t c; } tsbf_anon_pad2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint8_t : 1; uint8_t c; } sbf_anon_pad2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint8_t : 7; uint8_t c; } tsbf_anon_pad3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint8_t : 7; uint8_t c; } sbf_anon_pad3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint8_t : 8; uint8_t c; } tsbf_anon_pad4; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad4 struct \{ Godump_0 uint8; c uint8; \}$" } } */ + +struct { uint8_t : 8; uint8_t c; } sbf_anon_pad4; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad4 struct \{ Godump_0 uint8; c uint8; \}$" } } */ + +typedef struct { uint64_t : 0; uint8_t c; } tsbf_anon_pad5; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad5 struct \{ c uint8; \}$" } } */ + +struct { uint64_t : 0; uint8_t c; } sbf_anon_pad5; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad5 struct \{ c uint8; \}$" } } */ + +typedef struct { uint64_t : 1; uint8_t c; } tsbf_anon_pad6; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint64_t : 1; uint8_t c; } sbf_anon_pad6; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint64_t : 63; uint8_t c; } tsbf_anon_pad7; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; \}$" } } */ + +struct { uint64_t : 63; uint8_t c; } sbf_anon_pad7; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint64_t : 64; uint8_t c; } tsbf_anon_pad8; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad8 struct \{ Godump_0 uint64; c uint8; \}$" } } */ + +struct { uint64_t : 64; uint8_t c; } sbf_anon_pad8; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad8 struct \{ Godump_0 uint64; c uint8; \}$" } } */ + +typedef struct { uint8_t bf : 1; uint8_t c; } tsbf_pad8_1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint8_t bf : 1; uint8_t c; } sbf_pad8_1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint8_t bf : 7; uint8_t c; } tsbf_pad8_2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint8_t bf : 7; uint8_t c; } sbf_pad8_2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint8_t bf : 8; uint8_t c; } tsbf_pad8_3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_3 struct \{ bf uint8; c uint8; \}$" } } */ + +struct { uint8_t bf : 8; uint8_t c; } sbf_pad8_3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_3 struct \{ bf uint8; c uint8; \}$" } } */ + +typedef struct { uint16_t bf : 1; uint8_t c; } tsbf_pad16_1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ + +struct { uint16_t bf : 1; uint8_t c; } sbf_pad16_1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ + +typedef struct { uint16_t bf : 15; uint8_t c; } tsbf_pad16_2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ + +struct { uint16_t bf : 15; uint8_t c; } sbf_pad16_2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ + +typedef struct { uint16_t bf : 16; uint8_t c; } tsbf_pad16_3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_3 struct \{ bf uint16; c uint8; \}$" } } */ + +struct { uint16_t bf : 16; uint8_t c; } sbf_pad16_3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_3 struct \{ bf uint16; c uint8; \}$" } } */ + +typedef struct { uint32_t bf : 1; uint8_t c; } tsbf_pad32_1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +struct { uint32_t bf : 1; uint8_t c; } sbf_pad32_1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +typedef struct { uint32_t bf : 31; uint8_t c; } tsbf_pad32_2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +struct { uint32_t bf : 31; uint8_t c; } sbf_pad32_2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +typedef struct { uint32_t bf : 32; uint8_t c; } tsbf_pad32_3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_3 struct \{ bf uint32; c uint8; \}$" } } */ + +struct { uint32_t bf : 32; uint8_t c; } sbf_pad32_3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_3 struct \{ bf uint32; c uint8; \}$" } } */ + +typedef struct { uint64_t bf : 1; uint8_t c; } tsbf_pad64_1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int64; \}$" } } */ + +struct { uint64_t bf : 1; uint8_t c; } sbf_pad64_1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int64; \}$" } } */ + +typedef struct { uint64_t bf : 63; uint8_t c; } tsbf_pad64_2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_align \\\[0\\\]int64; \}$" } } */ + +struct { uint64_t bf : 63; uint8_t c; } sbf_pad64_2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_align \\\[0\\\]int64; \}$" } } */ + +typedef struct { uint64_t bf : 64; uint8_t c; } tsbf_pad64_3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint8; \}$" } } */ + +struct { uint64_t bf : 64; uint8_t c; } sbf_pad64_3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint8; \}$" } } */ + +typedef struct { uint8_t b1 : 1; } tsbf_1b; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ + +struct { uint8_t b1 : 1; } sbf_1b; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ + +typedef struct +{ + uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; + uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; +} tsbf_8b; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ + +struct +{ + uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; + uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; +} sbf_8b; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ + +typedef struct { + uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; + uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; + uint8_t b9 : 1; +} tsbf_9b; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */ + +struct { + uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; + uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; + uint8_t b9 : 1; +} sbf_9b; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */ + +typedef struct { + uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2; +} tsbf_18b; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */ + +struct { + uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2; +} sbf_18b; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */ + +struct +{ + uint16_t bf1 : 8; + uint8_t c; + uint16_t bf2 : 8; + uint32_t bf3 : 12; + uint16_t s; +} sbf_gaps; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_gaps struct \{ bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\[2\\\]byte; s uint16; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +typedef struct +{ + uint16_t bf1 : 8; + uint8_t c; + uint16_t bf2 : 8; + uint32_t bf3 : 12; + uint16_t s; +} tsbf_gaps; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_gaps struct \{ bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\[2\\\]byte; s uint16; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +typedef struct +{ + union + { + int64_t : 1; + union + { + int32_t bf : 1; + union + { + int16_t s; + int8_t c; + }; + }; + } u; +} ts_nested; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ + +struct +{ + union + { + int64_t : 1; + union + { + int32_t bf : 1; + union + { + int16_t s; + int8_t c; + }; + }; + } u; +} s_nested; +/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ + +typedef struct +{ + struct + { + int64_t : 1; + struct + { + int32_t bf : 1; + struct + { + int16_t s; + int8_t c; + }; + }; + } u; +} ts_nested2; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ + +struct +{ + struct + { + int64_t : 1; + struct + { + int32_t bf : 1; + struct + { + int16_t s; + int8_t c; + }; + }; + } u; +} s_nested2; +/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ + + +/*** unions ***/ +typedef union { } tue; +/* { dg-final { scan-file godump-1.out "(?n)^type _tue struct \{ \}$" } } */ + +union { } ue; +/* { dg-final { scan-file godump-1.out "(?n)^var _ue struct \{ \}$" } } */ + +typedef union { uint8_t c; uint64_t l; } tu1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu1 struct \{ c uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +union { uint8_t c; uint64_t l; } u1; +/* { dg-final { scan-file godump-1.out "(?n)^var _u1 struct \{ c uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +typedef union { uint64_t l; uint8_t c; } tu2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu2 struct \{ l uint64; \}$" } } */ + +union { uint64_t l; uint8_t c; } u2; +/* { dg-final { scan-file godump-1.out "(?n)^var _u2 struct \{ l uint64; \}$" } } */ + +typedef union { uint64_t l[3]; uint8_t c; } tu3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu3 struct \{ l \\\[2\\+1\\\]uint64; \}$" } } */ + +union { uint64_t l[3]; uint8_t c; } u3; +/* { dg-final { scan-file godump-1.out "(?n)^var _u3 struct \{ l \\\[2\\+1\\\]uint64; \}$" } } */ + +typedef struct { union { uint8_t c; uint64_t l; }; } tsu_anon; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsu_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ + +struct { union { uint8_t c; uint64_t l; }; } su_anon; +/* { dg-final { scan-file godump-1.out "(?n)^var _su_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ + +typedef union { uint64_t bf : 1; uint8_t ca[5]; } tu_size; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +union { uint64_t bf : 1; uint8_t ca[5]; } u_size; +/* { dg-final { scan-file godump-1.out "(?n)^var _u_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +typedef union { uint64_t : 1; uint8_t ca[5]; } tu2_size; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu2_size struct \{ ca \\\[4\\+1\\\]uint8; \}$" } } */ + +union { uint64_t : 1; uint8_t ca[5]; } u2_size; +/* { dg-final { scan-file godump-1.out "(?n)^var _u2_size struct \{ ca \\\[4\\+1\\\]uint8; \}$" } } */ + +typedef union u_undef_t u_undef_t2; + +typedef union { uint64_t b : 1; uint8_t ca[5]; } tu3_size; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +union { uint64_t b : 1; uint8_t ca[5]; } u3_size; +/* { dg-final { scan-file godump-1.out "(?n)^var _u3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +typedef union +{ + union + { + int64_t : 1; + union + { + int32_t bf : 1; + union + { + int16_t s; + int8_t c; + }; + }; + } u; +} tu_nested; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ + +union +{ + union + { + int64_t : 1; + union + { + int32_t bf : 1; + union + { + int16_t s; + int8_t c; + }; + }; + } u; +} u_nested; +/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ + +typedef union +{ + struct + { + int64_t : 1; + struct + { + int32_t bf : 1; + struct + { + int16_t s; + int8_t c; + }; + }; + } u; +} tu_nested2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ + +union +{ + struct + { + int64_t : 1; + struct + { + int32_t bf : 1; + struct + { + int16_t s; + int8_t c; + }; + }; + } u; +} u_nested2; +/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ + + +/*** functions ***/ +extern uint32_t func1(uint8_t c); +/* { dg-final { scan-file godump-1.out "(?n)^func _func1 \[(\]uint\[0-9\]*\[)\] uint\[0-9\]* __asm__\[(\]\"func1\"\[)\]$" } } */ + +typedef int8_t (*func_t)(void *p); +/* { dg-final { scan-file godump-1.out "(?n)^type _func_t func\[(\]\\*byte\[)\] int\[0-9\]*$" } } */ + +/* { dg-final { remove-build-file "godump-1.out" } } */ diff --git a/gcc/testsuite/gcc.misc-tests/godump.exp b/gcc/testsuite/gcc.misc-tests/godump.exp new file mode 100644 index 0000000000..7848731bd5 --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/godump.exp @@ -0,0 +1,36 @@ +# Copyright (C) 2014-2015 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" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/godump-*.c]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.misc-tests/help.exp b/gcc/testsuite/gcc.misc-tests/help.exp index e18912cfb5..e913919244 100644 --- a/gcc/testsuite/gcc.misc-tests/help.exp +++ b/gcc/testsuite/gcc.misc-tests/help.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2005-2014 Free Software Foundation, Inc. +# Copyright (C) 2005-2015 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 @@ -18,6 +18,16 @@ # documented in --help, and that the various --help* options work. load_lib options.exp +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p help] { + return +} +gcc_parallel_test_enable 0 # Document --version. Ideally, there should be no undocumented switches # in --help. @@ -78,3 +88,5 @@ check_for_options c "--help=joined,^separate" "--help=" "" "" check_for_options c "--help=joined,undocumented" "" "" "" # Listing only excludes gives empty results. check_for_options c "--help=^joined,^separate" "" "" "" + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp b/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp index 83e1045a96..5a3b84a085 100644 --- a/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp +++ b/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2015 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 @@ -98,16 +98,16 @@ if { [board_info target exists multilib_flags] } set-torture-options $PREFETCH_NONE -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] "" +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] "" "" set-torture-options $PREFETCH_SSE -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] "" +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] "" "" set-torture-options $PREFETCH_3DNOW -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] "" +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] "" "" set-torture-options $PREFETCH_ATHLON -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] "" +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] "" "" torture-finish dg-finish diff --git a/gcc/testsuite/gcc.misc-tests/linkage.exp b/gcc/testsuite/gcc.misc-tests/linkage.exp index eeef6c25a1..341619601a 100644 --- a/gcc/testsuite/gcc.misc-tests/linkage.exp +++ b/gcc/testsuite/gcc.misc-tests/linkage.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1988-2014 Free Software Foundation, Inc. +# Copyright (C) 1988-2015 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 @@ -18,6 +18,17 @@ # was written by Rob Savoye. (rob@cygnus.com) # All the other tests driven by that file have since been moved elsewhere. +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p linkage] { + return +} +gcc_parallel_test_enable 0 + if { [isnative] && ![is_remote host] } then { set lines [gcc_target_compile "$srcdir/$subdir/linkage-x.c" "linkage-x.o" object {additional_flags="-w"}] if ![string match "" $lines] then { @@ -33,8 +44,7 @@ if { [isnative] && ![is_remote host] } then { set native_cflags "-xarch=v9" } } - if {[istarget "i?86*-*-solaris2*"] - || [istarget "x86_64-*-solaris2.1\[0-9\]*"]} { + if {[istarget "i?86*-*-solaris2*"] || [istarget "x86_64-*-solaris2.1\[0-9\]*"]} { set file_string [exec file "linkage-x.o"] if [ string match "*64*" $file_string ] { set native_cflags "-xarch=amd64" @@ -48,9 +58,8 @@ if { [isnative] && ![is_remote host] } then { if [ string match "*64-bit*" $file_string ] { set native_cflags "-m64" } - } elseif {[istarget "i*86-*-linux*"] - || [istarget "i*86-*-gnu*"] - || [istarget "x86_64-*-linux*"]} then { + } elseif {[istarget "i?86-*-linux*"] || [istarget "x86_64-*-linux*"] + || [istarget "i?86-*-gnu*"] || [istarget "x86_64-*-gnu*"] } then { set file_string [exec file "linkage-x.o"] if [ string match "*32-bit*" $file_string ] { set native_cflags "-m32" @@ -117,3 +126,5 @@ if { [isnative] && ![is_remote host] } then { file delete "linkage-x.o" } } + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/matrix1.exp b/gcc/testsuite/gcc.misc-tests/matrix1.exp index fe06b1f9dc..4f0f5c4737 100644 --- a/gcc/testsuite/gcc.misc-tests/matrix1.exp +++ b/gcc/testsuite/gcc.misc-tests/matrix1.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2015 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 @@ -20,9 +20,21 @@ if { ![info exists PERF_TEST] || "$PERF_TEST" != "yes" } { } load_lib mike-gcc.exp +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p matrix1] { + return +} +gcc_parallel_test_enable 0 prebase set actions run set compiler_output "^$" set program_output "^$" postbase matrix1.c $run $groups + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/mg-2.exp b/gcc/testsuite/gcc.misc-tests/mg-2.exp index f2375c870b..e1b48f5d1b 100644 --- a/gcc/testsuite/gcc.misc-tests/mg-2.exp +++ b/gcc/testsuite/gcc.misc-tests/mg-2.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2005-2014 Free Software Foundation, Inc. +# Copyright (C) 2005-2015 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 @@ -17,8 +17,20 @@ # Test the -MG flag with a system header file. load_lib mike-gcc.exp +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p mg-2] { + return +} +gcc_parallel_test_enable 0 prebase set actions none-of-the-above set compiler_output "mg-2.o ?: .*mg-2.c \[ \\\\\n\]*nonexist.h" postbase mg-2.c "" "" "-MM -MG" + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/mg.exp b/gcc/testsuite/gcc.misc-tests/mg.exp index ad28ee78ef..94934c0ff2 100644 --- a/gcc/testsuite/gcc.misc-tests/mg.exp +++ b/gcc/testsuite/gcc.misc-tests/mg.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2015 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 @@ -17,8 +17,20 @@ # Test the -MG flag. load_lib mike-gcc.exp +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p mg] { + return +} +gcc_parallel_test_enable 0 prebase set actions none-of-the-above set compiler_output "mg.o ?: .*mg.c \[ \\\\\n\]*nonexist.h" postbase mg.c "" "" "-MM -MG" + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/options.exp b/gcc/testsuite/gcc.misc-tests/options.exp index bb619dc2b3..258c9f4c3c 100644 --- a/gcc/testsuite/gcc.misc-tests/options.exp +++ b/gcc/testsuite/gcc.misc-tests/options.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2005-2014 Free Software Foundation, Inc. +# Copyright (C) 2005-2015 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 @@ -19,6 +19,17 @@ # match the patterns COMPILER_PATTERN, AS_PATTERN and LD_PATTERN, # respectively. +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p options] { + return +} +gcc_parallel_test_enable 0 + proc check_for_all_options {language gcc_options compiler_pattern as_pattern ld_pattern} { set filename test-[pid] set fd [open $filename.c w] @@ -52,3 +63,5 @@ proc check_for_all_options {language gcc_options compiler_pattern as_pattern ld_ } check_for_all_options c {--coverage} {-fprofile-arcs -ftest-coverage} {} {-lgcov} + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/output.exp b/gcc/testsuite/gcc.misc-tests/output.exp new file mode 100644 index 0000000000..f51bab546c --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/output.exp @@ -0,0 +1,66 @@ +# Copyright (C) 2005-2015 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/>. + +# Run GCC with the input file also specified as output file. Check that the +# compiler prints an error message and does not overwrite the input file. + +load_lib gcc-defs.exp +load_lib target-supports.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p output] { + return +} + +# I'm not sure if this is needed here. It was in options.exp. +gcc_parallel_test_enable 0 + +proc check_gcc_overwrite_input {} { + set filename test-[pid] + set fd [open $filename.c w] + puts $fd "int main (void) \{ return 0; \}" + close $fd + remote_download host $filename.c + set test "input overwrite test" + set compiler cc1 + set gcc_output [gcc_target_compile $filename.c $filename.c executable ""] + + # Is this right, or do I need to use something like remote_upload? + set fd [open $filename.c r] + set file_data [read $fd] + close $fd + remote_file build delete $filename.c + + # check if the contents of the input file has changed + if {!($file_data eq "int main (void) \{ return 0; \}\n")} { + fail "$test (input overwritten)" + return + } + + # check if the error message was printed + if {![regexp -- "same as output" $gcc_output]} { + fail "$test (no error printed)" + return + } + pass $test +} + +check_gcc_overwrite_input + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/sieve.exp b/gcc/testsuite/gcc.misc-tests/sieve.exp index 7007b644c0..6db7a12fde 100644 --- a/gcc/testsuite/gcc.misc-tests/sieve.exp +++ b/gcc/testsuite/gcc.misc-tests/sieve.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2015 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 @@ -20,9 +20,21 @@ if { ![info exists PERF_TEST] || "$PERF_TEST" != "yes" } { } load_lib mike-gcc.exp +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p sieve] { + return +} +gcc_parallel_test_enable 0 prebase set actions run set compiler_output "^$" set program_output "^$" postbase sieve.c $run $groups + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/gcc.misc-tests/sort2.exp b/gcc/testsuite/gcc.misc-tests/sort2.exp index 28bdf1f84d..d6e5789a0b 100644 --- a/gcc/testsuite/gcc.misc-tests/sort2.exp +++ b/gcc/testsuite/gcc.misc-tests/sort2.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2015 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 @@ -20,9 +20,21 @@ if { ![info exists PERF_TEST] || "$PERF_TEST" != "yes" } { } load_lib mike-gcc.exp +load_lib gcc-defs.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p sort2] { + return +} +gcc_parallel_test_enable 0 prebase set actions run set compiler_output "^$" set program_output "^$" postbase sort2.c $run $groups + +gcc_parallel_test_enable 1 |