From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/g++.old-deja/g++.ext/addrfunc1.C | 18 +++++ gcc/testsuite/g++.old-deja/g++.ext/addrfunc2.C | 17 +++++ gcc/testsuite/g++.old-deja/g++.ext/addrfunc3.C | 14 ++++ gcc/testsuite/g++.old-deja/g++.ext/addrfunc4.C | 25 +++++++ gcc/testsuite/g++.old-deja/g++.ext/anon1.C | 15 +++++ gcc/testsuite/g++.old-deja/g++.ext/anon2.C | 15 +++++ gcc/testsuite/g++.old-deja/g++.ext/anon3.C | 36 ++++++++++ gcc/testsuite/g++.old-deja/g++.ext/array1.C | 23 +++++++ gcc/testsuite/g++.old-deja/g++.ext/array2.C | 13 ++++ gcc/testsuite/g++.old-deja/g++.ext/array3.C | 10 +++ gcc/testsuite/g++.old-deja/g++.ext/array4.C | 31 +++++++++ gcc/testsuite/g++.old-deja/g++.ext/arrnew.C | 8 +++ gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C | 8 +++ gcc/testsuite/g++.old-deja/g++.ext/asmspec1.C | 7 ++ gcc/testsuite/g++.old-deja/g++.ext/attrib1.C | 11 +++ gcc/testsuite/g++.old-deja/g++.ext/attrib2.C | 16 +++++ gcc/testsuite/g++.old-deja/g++.ext/attrib3.C | 21 ++++++ gcc/testsuite/g++.old-deja/g++.ext/attrib4.C | 24 +++++++ gcc/testsuite/g++.old-deja/g++.ext/attrib5.C | 14 ++++ gcc/testsuite/g++.old-deja/g++.ext/attrib6.C | 6 ++ gcc/testsuite/g++.old-deja/g++.ext/bound1.C | 29 ++++++++ gcc/testsuite/g++.old-deja/g++.ext/constructor.C | 20 ++++++ gcc/testsuite/g++.old-deja/g++.ext/default.C | 27 ++++++++ gcc/testsuite/g++.old-deja/g++.ext/delvoid.C | 12 ++++ gcc/testsuite/g++.old-deja/g++.ext/jump1.C | 17 +++++ gcc/testsuite/g++.old-deja/g++.ext/label1.C | 28 ++++++++ gcc/testsuite/g++.old-deja/g++.ext/label2.C | 35 ++++++++++ gcc/testsuite/g++.old-deja/g++.ext/memconst.C | 25 +++++++ gcc/testsuite/g++.old-deja/g++.ext/namedret1.C | 13 ++++ gcc/testsuite/g++.old-deja/g++.ext/namedret2.C | 20 ++++++ gcc/testsuite/g++.old-deja/g++.ext/namedret3.C | 31 +++++++++ gcc/testsuite/g++.old-deja/g++.ext/noweak1.C | 17 +++++ gcc/testsuite/g++.old-deja/g++.ext/null1.C | 9 +++ gcc/testsuite/g++.old-deja/g++.ext/overload1.C | 20 ++++++ gcc/testsuite/g++.old-deja/g++.ext/pretty.C | 42 ++++++++++++ gcc/testsuite/g++.old-deja/g++.ext/pretty2.C | 85 ++++++++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.ext/pretty3.C | 47 +++++++++++++ gcc/testsuite/g++.old-deja/g++.ext/pretty4.C | 85 ++++++++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.ext/restrict1.C | 60 +++++++++++++++++ gcc/testsuite/g++.old-deja/g++.ext/return1.C | 20 ++++++ gcc/testsuite/g++.old-deja/g++.ext/stmtexpr1.C | 8 +++ gcc/testsuite/g++.old-deja/g++.ext/syshdr1.C | 11 +++ gcc/testsuite/g++.old-deja/g++.ext/typename1.C | 31 +++++++++ gcc/testsuite/g++.old-deja/g++.ext/typeof1.C | 17 +++++ gcc/testsuite/g++.old-deja/g++.ext/typeof2.C | 8 +++ 45 files changed, 1049 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/addrfunc1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/addrfunc2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/addrfunc3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/addrfunc4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/anon1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/anon2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/anon3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/array1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/array2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/array3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/array4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/arrnew.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/asmspec1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/attrib1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/attrib2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/attrib3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/attrib4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/attrib5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/attrib6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/bound1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/constructor.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/default.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/delvoid.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/jump1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/label1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/label2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/memconst.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/namedret1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/namedret2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/namedret3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/noweak1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/null1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/overload1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/pretty.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/pretty2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/pretty3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/pretty4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/restrict1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/return1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/stmtexpr1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/syshdr1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/typename1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/typeof1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.ext/typeof2.C (limited to 'gcc/testsuite/g++.old-deja/g++.ext') diff --git a/gcc/testsuite/g++.old-deja/g++.ext/addrfunc1.C b/gcc/testsuite/g++.old-deja/g++.ext/addrfunc1.C new file mode 100644 index 000000000..3fec371c2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/addrfunc1.C @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-fms-extensions" } +// Test that taking the address of a member function name produces +// a pointer to member function. +// Contributed by Jason Merrill + +struct A { }; +int (A::*p)(); + +struct B { + int f () { return 0; } + void g (); +}; + +void B::g () +{ + p = (int (A::*)())&f; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/addrfunc2.C b/gcc/testsuite/g++.old-deja/g++.ext/addrfunc2.C new file mode 100644 index 000000000..7314d1632 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/addrfunc2.C @@ -0,0 +1,17 @@ +// { dg-do run } +// { dg-options "-fms-extensions" } +// Test for implicit & on methods. +// Contributed by Jason Merrill . + +struct A { + void f (int = 0) { } +}; + +int +main () +{ + void (A::*p)(int) = 0; + p = A::f; + if (p != A::f) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/addrfunc3.C b/gcc/testsuite/g++.old-deja/g++.ext/addrfunc3.C new file mode 100644 index 000000000..16d33186f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/addrfunc3.C @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-options "-fpermissive -w" } +// Test for overload resolution in comparison expressions. +// Contributed by Jason Merrill . + +void f (int) { } +void f (); + +int main () { + void (*p)(int); + p = f; + if (p != f) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/addrfunc4.C b/gcc/testsuite/g++.old-deja/g++.ext/addrfunc4.C new file mode 100644 index 000000000..05312e4e5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/addrfunc4.C @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-options "-fms-extensions" } +// Test that an object-dependent reference to a member function can be +// used to produce a pointer to member function, as in VC++. +// Contributed by Jason Merrill + +struct A +{ + int f(int a) { return 0; } + void f(int a, int b) { } +}; + +typedef int (A::* pmf1)(int); +typedef void (A::* pmf2)(int, int); + +int main() +{ + A a; + pmf1 fn1; + pmf2 fn2; + + fn1 = a.f; + fn1 = (pmf1)a.f; + fn2 = (pmf2)a.f; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/anon1.C b/gcc/testsuite/g++.old-deja/g++.ext/anon1.C new file mode 100644 index 000000000..6fc6d2e91 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/anon1.C @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-options "" } + +union U { + struct { int i; int j; }; + int a[2]; +}; + +int main () +{ + U u; + u.i = 42; + u.a[1] = 24; + return u.j != 24 || u.a[0] != 42; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/anon2.C b/gcc/testsuite/g++.old-deja/g++.ext/anon2.C new file mode 100644 index 000000000..5bde08db9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/anon2.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "" } +// { dg-prune-output "note" } + +struct S +{ + S (); +}; + +union U { + struct { + S s; // { dg-error "" } struct with constructor in union + }; +}; + diff --git a/gcc/testsuite/g++.old-deja/g++.ext/anon3.C b/gcc/testsuite/g++.old-deja/g++.ext/anon3.C new file mode 100644 index 000000000..44c03c7fa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/anon3.C @@ -0,0 +1,36 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 6 Jun 2001 + +// Bug 2914. New types can be created in a static member +// initializer. These should not be injected into the member's class's +// scope. + +class DoubleSupport +{ + public: + static void toDouble(); + + static const double s_NaN; + static const double s_positiveInfinity; + static const double s_negativeInfinity; + static const double s_positiveZero; + static const double s_negativeZero; + static const unsigned long* s_NaNFirstDWORD; + static const unsigned long* s_NaNSecondDWORD; +}; + +const double DoubleSupport::s_positiveInfinity = +(__extension__ ((union { unsigned char __c[8]; double __d; }) + { __c: { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }).__d); + +struct other +{ +}; + + +void +DoubleSupport::toDouble() +{ +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/array1.C b/gcc/testsuite/g++.old-deja/g++.ext/array1.C new file mode 100644 index 000000000..a297c73b8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/array1.C @@ -0,0 +1,23 @@ +// { dg-do assemble } +// { dg-options "" } +// Testcase for assignment of non-array to array (assigns the same value to +// each member) +// Special Options: + +typedef struct {} ct2d_rigid, ct2d_rigid_a[1]; +class ccInspection +{ +protected: + ct2d_rigid_a _dev2phys; +}; +class ccBgaInspection : public ccInspection +{ +public: + void reinspect (unsigned long diagFlags); +}; +void +ccBgaInspection::reinspect (unsigned long diag_flags) +{ + ct2d_rigid physTdev; + _dev2phys = physTdev; // { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/array2.C b/gcc/testsuite/g++.old-deja/g++.ext/array2.C new file mode 100644 index 000000000..88482fe19 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/array2.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "-w" } +// This testcase used to cause a crash on the Alpha. + +struct A { + int i; + ~A() { } +}; + +A f (int n) +{ + A a[n]; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/array3.C b/gcc/testsuite/g++.old-deja/g++.ext/array3.C new file mode 100644 index 000000000..b60b407c8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/array3.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "" } +// Origin: Mark Mitchell + +void *vp; + +void f () +{ + int i = (*((int (*)[i]) vp))[0]; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/array4.C b/gcc/testsuite/g++.old-deja/g++.ext/array4.C new file mode 100644 index 000000000..f0a90d842 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/array4.C @@ -0,0 +1,31 @@ +// { dg-do assemble } +// { dg-options "" } + + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Mark Mitchell 19 Mar 2000 +// Nathan Sidwell 19 Mar 2000 + +// [nathan] We have a zero sized array extension, and (unfortunately) allow it +// to be the sole member of a struct (rather than the trailing member of a +// non-empty struct as C99 is/will allow). Such a type will have a size of +// zero, but is not incomplete. + +struct A +{ + int m[0]; +}; + +void foo () +{ + A a; +} + +template +struct S +{ + int x[0]; +}; + +template struct S; + diff --git a/gcc/testsuite/g++.old-deja/g++.ext/arrnew.C b/gcc/testsuite/g++.old-deja/g++.ext/arrnew.C new file mode 100644 index 000000000..ea3f42014 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/arrnew.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// { dg-options "" } +// PRMS Id: 4992 + +int *f(){ + return new int[1] = { 1 }; // { dg-error "lvalue" "err" } + // { dg-warning "extended init" "warn" { target *-*-* } 6 } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C b/gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C new file mode 100644 index 000000000..93d15d08d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C @@ -0,0 +1,8 @@ +// { dg-do run { xfail *-*-* } } +// { dg-options "-w -fpermissive" } + +int *foo = new int[1](42); // { dg-bogus "" } +int main () +{ + return foo[0] != 42; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/asmspec1.C b/gcc/testsuite/g++.old-deja/g++.ext/asmspec1.C new file mode 100644 index 000000000..97d4b8e6b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/asmspec1.C @@ -0,0 +1,7 @@ +// { dg-do assemble { target i?86-*-* x86_64-*-* } } +// Origin: Anthony Green + +void foo () +{ + register const char *h asm("%esi") = "hey"; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/attrib1.C b/gcc/testsuite/g++.old-deja/g++.ext/attrib1.C new file mode 100644 index 000000000..e87979166 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/attrib1.C @@ -0,0 +1,11 @@ +// { dg-do assemble { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target ilp32 } +// Test for using prefix attributes in a parameter decl. +// Contributed by Jason Merrill + +#define _stdcall __attribute__ ((__stdcall__)) + +typedef void (_stdcall* pfn)(); + +void f (void (_stdcall*) ()); +void f (void (_stdcall* pfn)()); diff --git a/gcc/testsuite/g++.old-deja/g++.ext/attrib2.C b/gcc/testsuite/g++.old-deja/g++.ext/attrib2.C new file mode 100644 index 000000000..09b2bf2e6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/attrib2.C @@ -0,0 +1,16 @@ +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target ilp32 } +// Test that stdcall doesn't prevent us from using op delete. +// Contributed by Jason Merrill + +struct A { + void operator delete (void *) __attribute__ ((stdcall)); +}; + +void A::operator delete (void *) { } + +int main() +{ + A* ap = new A; + delete ap; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/attrib3.C b/gcc/testsuite/g++.old-deja/g++.ext/attrib3.C new file mode 100644 index 000000000..7d9c70e3b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/attrib3.C @@ -0,0 +1,21 @@ +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target ilp32 } +// Test for proper handling of attributes in template instantiation. +// Contributed by Jason Merrill + +template +struct A { + static void f () __attribute__ ((stdcall)); +}; + +template void +A::f () { } + +void g (void (__attribute__ ((stdcall)) *p)()) { } +void g (int); + +int +main () +{ + g (&A::f); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/attrib4.C b/gcc/testsuite/g++.old-deja/g++.ext/attrib4.C new file mode 100644 index 000000000..5c2f03e4b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/attrib4.C @@ -0,0 +1,24 @@ +// { dg-do assemble } +// { dg-options "-Wformat" } +// Test that attributes are really applied to function declarations under +// various conditions. +// Contributed by Jason Merrill (jason@cygnus.com) + +#define PF __attribute__ ((format (printf, 1, 2))) + +struct A { + static PF void f (const char *, ...); + static PF void g (const char *, ...) { } + static void test (); +}; + +void PF h (const char *, ...); +void PF k (const char *, ...) { } + +void A::test () +{ + f ("%f", 42); // { dg-warning "argument 2" } + g ("%f", 42); // { dg-warning "argument 2" } + h ("%f", 42); // { dg-warning "argument 2" } + k ("%f", 42); // { dg-warning "argument 2" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/attrib5.C b/gcc/testsuite/g++.old-deja/g++.ext/attrib5.C new file mode 100644 index 000000000..fcc3c6167 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/attrib5.C @@ -0,0 +1,14 @@ +// { dg-do run { xfail alpha*-dec-osf* i?86-pc-cygwin } } +// Test that attributes weak and alias coexist. +// { dg-require-weak "" } +// { dg-require-alias "" } + +extern "C" { + void _f () { } + void f () __attribute__((weak, alias ("_f"))); +} + +int main () +{ + f (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/attrib6.C b/gcc/testsuite/g++.old-deja/g++.ext/attrib6.C new file mode 100644 index 000000000..5c12f0a70 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/attrib6.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Test that postfix attributes only apply to a single declared object. +// (decl_attributes used to chain them onto the end of the prefix attributes, +// which caused them to apply to other declarations as well.) +// Origin: Joseph Myers . +void __attribute__((__noreturn__)) foo (const char *, ...) __attribute__((__format__(__printf__, 1, 2))), bar (void); diff --git a/gcc/testsuite/g++.old-deja/g++.ext/bound1.C b/gcc/testsuite/g++.old-deja/g++.ext/bound1.C new file mode 100644 index 000000000..5812f4afa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/bound1.C @@ -0,0 +1,29 @@ +// { dg-do assemble } +// { dg-options "-Wno-pmf-conversions" } +// Testcase for cast of bound pointer to member function. + +struct A { + int f (); +}; + +typedef int (*fptr)(A *); +typedef void* vptr; +typedef int (A::*pmf)(); + +void foo (A* ap, pmf fp, int A::* ip) +{ + fptr p; + vptr q; + A a; + + p = (fptr)(ap->*fp); + p = (fptr)(ap->*fp); + p = (fptr)(ap->*(&A::f)); + p = (fptr)(a.*fp); + p = (fptr)(a.*(&A::f)); + + q = (vptr)(ap->*fp); + q = (vptr)(ap->*(&A::f)); + q = (vptr)(a.*fp); + q = (vptr)(a.*(&A::f)); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/constructor.C b/gcc/testsuite/g++.old-deja/g++.ext/constructor.C new file mode 100644 index 000000000..a7995bbfe --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/constructor.C @@ -0,0 +1,20 @@ +// { dg-do run } +// { dg-options "" } +// Testcase for constructor expressions (GNU extension) + +struct Any { + int *type; + int *addr; +}; + +int i, j; + +main () { + struct Any *ap = (struct Any *) + __builtin_alloca (sizeof(struct Any)); + *ap = ((struct Any){ &i, &j }) ; + + if (ap->type != &i || ap->addr != &j) + return 1; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/default.C b/gcc/testsuite/g++.old-deja/g++.ext/default.C new file mode 100644 index 000000000..9f4395e77 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/default.C @@ -0,0 +1,27 @@ +// { dg-do assemble } +// PRMS Id: 5353 +// This may be an extension, but it's a very common one... + +extern "C" int printf (const char *, ...); + +class A { +public: + static A*func (int = 3); + static A*(*ptr)(int = 4); // { dg-error "" } .* +}; + +A*(*A::ptr)(int) = &A::func; + +int main() +{ + A foo; + + A::ptr(); // { dg-error "" } .* + A::ptr(47); +} + +A*A::func(int i) +{ + printf("I = %d\n",i); + return (A*)0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/delvoid.C b/gcc/testsuite/g++.old-deja/g++.ext/delvoid.C new file mode 100644 index 000000000..60f114b31 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/delvoid.C @@ -0,0 +1,12 @@ +// { dg-do run } +// { dg-options "-w" } +// Jason Merrill +// Test for deleting a void pointer, which the standard says is undefined, +// but which is used by several free C++ programs. + +void *p; + +int main () +{ + delete [] p; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/jump1.C b/gcc/testsuite/g++.old-deja/g++.ext/jump1.C new file mode 100644 index 000000000..d5dcebca2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/jump1.C @@ -0,0 +1,17 @@ +// { dg-do run } +// { dg-options "-fpermissive -w" } +// Test that we can jump over the declaration of a non-POD object. +// Contributed by Jason Merrill + +struct A { }; +union U { + void (A::*p)(); +}; + +int main() +{ + goto foo; + U u; + foo: + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/label1.C b/gcc/testsuite/g++.old-deja/g++.ext/label1.C new file mode 100644 index 000000000..8bf82ce7a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/label1.C @@ -0,0 +1,28 @@ +// { dg-do run } +// { dg-options "" } +// Origin: Mark Mitchell + +int main () +{ + int i = 0; + int j = 0; + int k = 0; + + l: + if (j) + return 0; + ({ + __label__ l; + k = 0; + l: + if (++k <= 2) + goto l; + ++i;}); + if (i > 1 || k != 3) + return 1; + else + { + j = 1; + goto l; + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/label2.C b/gcc/testsuite/g++.old-deja/g++.ext/label2.C new file mode 100644 index 000000000..1ba67d096 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/label2.C @@ -0,0 +1,35 @@ +// { dg-do run } +// { dg-options "" } +// Origin: Mark Mitchell + +template +int f () +{ + int i = 0; + int j = 0; + int k = 0; + + l: + if (j) + return 0; + ({ + __label__ l; + k = 0; + l: + if (++k <= 2) + goto l; + ++i;}); + if (i > 1 || k != 3) + return 1; + else + { + j = 1; + goto l; + } +} + +int main () +{ + return f(); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.ext/memconst.C b/gcc/testsuite/g++.old-deja/g++.ext/memconst.C new file mode 100644 index 000000000..7dd2df736 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/memconst.C @@ -0,0 +1,25 @@ +// { dg-do assemble } +// { dg-options "" } +// From: Ove.Ewerlid@syscon.uu.se (Ove Ewerlid) +// Subject: ss-940630:cc1plus: internal error +// Date: Sat, 2 Jul 1994 05:07:20 +0200 + +class qwerty { +public: + qwerty (const unsigned short userkey[8]); + ~qwerty (); +}; + +class foo { +private: + static const unsigned char * const dummy_key = (unsigned char*)"ThisIs a dummy!"; // { dg-error "" } + +public: + void bar (); +}; + +void +foo::bar () +{ + qwerty QWERTY ((unsigned short*)dummy_key); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/namedret1.C b/gcc/testsuite/g++.old-deja/g++.ext/namedret1.C new file mode 100644 index 000000000..29955fb52 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/namedret1.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } + +int f(int x) return y(x) { } // { dg-error "" } + +extern "C" void abort (); + +int main() +{ + if (f(1) != 1 || f(2) != 2 || f(3) != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/namedret2.C b/gcc/testsuite/g++.old-deja/g++.ext/namedret2.C new file mode 100644 index 000000000..339fc11e2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/namedret2.C @@ -0,0 +1,20 @@ +// { dg-do assemble { target alpha*-*-* } } +// { dg-options "-Wno-deprecated" } + +// This test verifies that return type promotion is working correctly. +// The Alpha ABI specifies that 32-bit return values have bit 31 propagated, +// i.e. the value is sign-extended even if the unpromoted type is unsigned. + +unsigned int f(unsigned int x) return y(x) { } // { dg-error "" } + +extern "C" void abort (); + +int main() +{ + typedef long (*long_func)(long); + long_func g = reinterpret_cast(f); + + if (g(-1L) != -1L) + abort (); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/namedret3.C b/gcc/testsuite/g++.old-deja/g++.ext/namedret3.C new file mode 100644 index 000000000..7a0e0d594 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/namedret3.C @@ -0,0 +1,31 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } + +extern "C" void abort(); + +int f2(int *x) +{ + *x = 1; + return 2; +} + +int f1() return x // { dg-error "" } +{ + f2(&x); // { dg-error "" } +} + +void g() +{ + int scratch[100]; + int i; + for (i = 0; i < 100; ++i) + scratch[i] = 0; +} + +int main() +{ + g(); + if (f1() != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/noweak1.C b/gcc/testsuite/g++.old-deja/g++.ext/noweak1.C new file mode 100644 index 000000000..7d73cba7a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/noweak1.C @@ -0,0 +1,17 @@ +// { dg-do run } +// { dg-options "-fno-weak" } +// Test that -fno-weak doesn't break explicit instantiation of static data. + +template struct A +{ + static int i; +}; + +template int A::i = 42; + +template class A; + +int main () +{ + return (A::i != 42); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/null1.C b/gcc/testsuite/g++.old-deja/g++.ext/null1.C new file mode 100644 index 000000000..6bbfe7e47 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/null1.C @@ -0,0 +1,9 @@ +// { dg-do run } +// Test for overloading with g++ NULL. + +void f (int *) { } +void f (char, char); +int main () +{ + f (__null); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/overload1.C b/gcc/testsuite/g++.old-deja/g++.ext/overload1.C new file mode 100644 index 000000000..f7c8018ec --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/overload1.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-fpermissive" } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Feb 2001 + +// Make sure we warn about our overload extension about picking the +// one with the least worse conversion + +struct X +{ + X (int); +}; +void Foo (int, float, bool); // { dg-message "candidate" } +void Foo (float, int, X); // { dg-message "candidate" } + +void Baz () +{ + Foo (1, 1, 0); // { dg-warning "worst" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/pretty.C b/gcc/testsuite/g++.old-deja/g++.ext/pretty.C new file mode 100644 index 000000000..7a0029b23 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/pretty.C @@ -0,0 +1,42 @@ +// { dg-do assemble } +// Test for PRETTY_FUNCTION + +class SV; + +class SVTable // : public Debug +{ + // It is an array to pointer to a SV. + SV ** array; + + // This is the size of array. + int maxCount; + + // This is the current element count. + int count; + + void fatal_error (const char *f, ...); + +public: + SVTable (int size, const char *d); + SVTable (); + SVTable (const SVTable &); + ~SVTable () {} + +}; + + +SVTable::SVTable (int size, const char *d) + : maxCount (size), count (0)// , Debug (d) +{ + if (size < 0) + { + fatal_error ("%s: Invalid size: %d\n", __PRETTY_FUNCTION__, size); + } + + array = (SV **) new SV * [size]; + + if (array == 0) + { + fatal_error ("%s: Failed to allocate array\n", __PRETTY_FUNCTION__); + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/pretty2.C b/gcc/testsuite/g++.old-deja/g++.ext/pretty2.C new file mode 100644 index 000000000..26d4d71cd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/pretty2.C @@ -0,0 +1,85 @@ +// { dg-do run } +// Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in member functions + +#include +#include + +static bool bad = false; + +struct X +{ + X (); + ~X (); + void fn (); + operator int (); +}; + +X::X () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("ctor\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "X")) + bad = true; + if (strcmp (pretty, "X::X()")) + bad = true; +} +X::~X () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("dtor\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "~X")) + bad = true; + if (strcmp (pretty, "X::~X()")) + bad = true; +} +void X::fn () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("member fn\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "fn")) + bad = true; + if (strcmp (pretty, "void X::fn()")) + bad = true; +} +X::operator int () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("conversion\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (pretty, "X::operator int()")) + bad = true; + return 0; +} + +int main () +{ + { + X x; + + x.fn (); + (void)int (x); + } + return bad; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/pretty3.C b/gcc/testsuite/g++.old-deja/g++.ext/pretty3.C new file mode 100644 index 000000000..6348ae1ee --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/pretty3.C @@ -0,0 +1,47 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in templates + +#include +#include + +static bool bad = false; + +template void f1 (T) +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("generic\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "f1")) + bad = true; + if (strcmp (pretty, "void f1(T) [with T = float]")) // only for float instantiation + bad = true; +} + +template<> void f1 (int) +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("specialized\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "f1")) + bad = true; + if (strcmp (pretty, "void f1(T) [with T = int]")) + bad = true; +} + +int main () +{ + f1(0); // f1 + f1(0.0f); // f1 + return bad; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/pretty4.C b/gcc/testsuite/g++.old-deja/g++.ext/pretty4.C new file mode 100644 index 000000000..9017d5671 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/pretty4.C @@ -0,0 +1,85 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 3 Mar 2000 + +// __PRETTY_FUNCTION__, __FUNCTION__ and __function__ should have the +// type char const [X], where X is the right value for that particular function + +static void const *strings[4]; +static void const *tpls[4]; +static unsigned pos = 0; +static int fail; +static void const *ptr = 0; + +void unover (char const (*)[5]) {} +void foo (char const (*)[5]) {} +void foo (void *) {fail = 1;} +void foo (void const *) {fail = 1;} +void baz (char const (&)[5]) {} + +template void PV (char const (&objRef)[I]) +{ + strings[pos] = objRef; + tpls[pos] = __PRETTY_FUNCTION__; + pos++; +} + +void fn () +{ + PV (__FUNCTION__); + PV (__func__); + PV (__PRETTY_FUNCTION__); + PV ("wibble"); +} + +void baz () +{ + ptr = __FUNCTION__; + // there should be no string const merging + if (ptr == "baz") + fail = 1; + // but all uses should be the same. + if (ptr != __FUNCTION__) + fail = 1; +} +int baz (int) +{ + return ptr == __FUNCTION__; +} + +int main () +{ + // make sure we actually emit the VAR_DECL when needed, and things have the + // expected type. + foo (&__FUNCTION__); + baz (__FUNCTION__); + unover (&__FUNCTION__); + if (fail) + return 1; + + // __FUNCTION__ should be unique across functions with the same base name + // (it's a local static, _not_ a string). + baz (); + if (fail) + return 1; + if (baz (1)) + return 1; + fn (); + + // Check the names of fn. They should all be distinct strings (though two + // will have the same value). + if (strings[0] == strings[1]) + return 1; + if (strings[0] == strings[2]) + return 1; + if (strings[1] == strings[2]) + return 1; + + // check the names of the template functions so invoked + if (tpls[0] != tpls[1]) + return 1; + if (tpls[0] == tpls[2]) + return 1; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/restrict1.C b/gcc/testsuite/g++.old-deja/g++.ext/restrict1.C new file mode 100644 index 000000000..0904eb690 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/restrict1.C @@ -0,0 +1,60 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Nov 1999 +// Test our restrict object pointer extension + +struct A +{ + void f1() __restrict__; + void g1(int *__restrict__); + void f2() __restrict__; + void g2(int *__restrict__); + void f3(); + void g3(int *); + void f4(); + void g4(int *); +}; + +void A::f1 () __restrict__ {} +void A::g1 (int *__restrict__) {} + +void A::f2 () {} +void A::g2 (int *) {} + +void A::f3 () __restrict__ {} +void A::g3 (int *__restrict__) {} + +void A::f4 () {} +void A::g4 (int *) {} + +template struct X +{ + void f1() __restrict__; + void g1(int *__restrict__); + void f2() __restrict__; + void g2(int *__restrict__); + void f3(); + void g3(int *); + void f4(); + void g4(int *); +}; + +template void X::f1 () __restrict__ {} +template void X::g1 (int *__restrict__) {} +template void X::f2 () {} +template void X::g2 (int *) {} +template void X::f3 () __restrict__ {} +template void X::g3 (int *__restrict__) {} +template void X::f4 () {} +template void X::g4 (int *) {} + +void fn () +{ + X g; + + g.f1 (); + g.f2 (); + g.f3 (); + g.f4 (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/return1.C b/gcc/testsuite/g++.old-deja/g++.ext/return1.C new file mode 100644 index 000000000..f6bbc4da2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/return1.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } +// Test that the named return value extension works when passed as a reference. +// Origin: Jason Merrill + +void f (int &i) +{ + i = 42; +} + +int g () return r // { dg-error "" } named return value +{ + f (r); // { dg-error "" } undeclared +} + +int main () +{ + int i = g (); + return (i != 42); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/stmtexpr1.C b/gcc/testsuite/g++.old-deja/g++.ext/stmtexpr1.C new file mode 100644 index 000000000..a746fc36e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/stmtexpr1.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// { dg-options "" } +// Origin: Mark Mitchell + +void f () +{ + int i = ({ l: 3; }); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/syshdr1.C b/gcc/testsuite/g++.old-deja/g++.ext/syshdr1.C new file mode 100644 index 000000000..09e64bff6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/syshdr1.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// { dg-options "" } +// Test that we don't complain about trying to define bool or wchar_t in a +// system header. + + +# 1 "syshdr1.C" +# 1 "syshdr1.h" 1 3 +typedef int bool; +typedef int wchar_t; +# 2 "syshdr1.C" 2 diff --git a/gcc/testsuite/g++.old-deja/g++.ext/typename1.C b/gcc/testsuite/g++.old-deja/g++.ext/typename1.C new file mode 100644 index 000000000..2efeba93d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/typename1.C @@ -0,0 +1,31 @@ +// { dg-do run } +// Bug: g++ forgets about the instantiation of class1 when looking up +// class11_value, and tries to look things up in class1. + +template +struct class1 { + struct class11 { + typedef ItIsInt class11_value; + }; +}; + +template +struct class3 { + int f(); +}; + +template +int class3::f() +{ + return typename class1::class11::class11_value(10); +} + +struct class2 { + typedef int class2_value; +}; + +int main() +{ + class3 the_class3; + the_class3.f(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/typeof1.C b/gcc/testsuite/g++.old-deja/g++.ext/typeof1.C new file mode 100644 index 000000000..892150445 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/typeof1.C @@ -0,0 +1,17 @@ +// { dg-do assemble } + +struct inttest { + int elem[1]; +}; + +template +void F(T x) +{ + typedef __typeof (x.elem[0]) dummy; + dummy i = 1; +} + +int main() { + inttest x; + F(x); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/typeof2.C b/gcc/testsuite/g++.old-deja/g++.ext/typeof2.C new file mode 100644 index 000000000..008ecf6da --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/typeof2.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S +{ + int i; + __typeof( S::i ) f (); +}; -- cgit v1.2.3