From 5f3aebeadf5ab4252900620f88a2159b2bafca3f Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Wed, 17 Jan 2001 19:09:35 +0000 Subject: [PATCH] builtins1.C: New test. * g++.old-deja/g++.other/builtins1.C: New test. * g++.old-deja/g++.other/builtins2.C: Likewise. * g++.old-deja/g++.other/builtins3.C: Likewise. * g++.old-deja/g++.other/builtins4.C: Likewise. From-SVN: r39095 --- gcc/testsuite/ChangeLog | 7 ++++ .../g++.old-deja/g++.other/builtins1.C | 33 +++++++++++++++ .../g++.old-deja/g++.other/builtins2.C | 40 +++++++++++++++++++ .../g++.old-deja/g++.other/builtins3.C | 39 ++++++++++++++++++ .../g++.old-deja/g++.other/builtins4.C | 39 ++++++++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/builtins1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.other/builtins2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.other/builtins3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.other/builtins4.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4dc5f061b31..ab2f3104f78 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2001-01-17 Kaveh R. Ghazi + + * g++.old-deja/g++.other/builtins1.C: New test. + * g++.old-deja/g++.other/builtins2.C: Likewise. + * g++.old-deja/g++.other/builtins3.C: Likewise. + * g++.old-deja/g++.other/builtins4.C: Likewise. + 2001-01-17 Jakub Jelinek * gcc.c-torture/compile/20010117-1.c: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.other/builtins1.C b/gcc/testsuite/g++.old-deja/g++.other/builtins1.C new file mode 100644 index 00000000000..b6cea1e201f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/builtins1.C @@ -0,0 +1,33 @@ +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// +// Special g++ Options: -O2 + +namespace std +{ + extern "C" void abort (void); + extern "C" __SIZE_TYPE__ strlen (const char *); +} + +int main () +{ + using namespace std; + + if (strlen ("hello") != 5) + abort (); + if (std::strlen ("hello") != 5) + abort (); + if (::__builtin_strlen ("hello") != 5) + abort (); + + return 0; +} + +extern "C" +{ + static __SIZE_TYPE__ ::strlen (const char *) + { + std::abort (); + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/builtins2.C b/gcc/testsuite/g++.old-deja/g++.other/builtins2.C new file mode 100644 index 00000000000..48e53f14343 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/builtins2.C @@ -0,0 +1,40 @@ +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// +// Special g++ Options: -O2 + +namespace std +{ + extern "C" void abort (void); + extern "C" char *strcpy (char *, const char *); + extern "C" int memcmp (const void *, const void *, __SIZE_TYPE__); +} + +int main () +{ + using namespace std; + char f[16]; + + if (strcpy (f, "hello world") != f + || memcmp (f, "hello world", sizeof ("hello world"))) + abort (); + + if (std::strcpy (f, "bye world") != f + || memcmp (f, "bye world", sizeof ("bye world"))) + abort (); + + if (::__builtin_strcpy (f, "hello world") != f + || memcmp (f, "hello world", sizeof ("hello world"))) + abort (); + + return 0; +} + +extern "C" +{ + static char * ::strcpy (char *, const char *) + { + std::abort (); + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/builtins3.C b/gcc/testsuite/g++.old-deja/g++.other/builtins3.C new file mode 100644 index 00000000000..4a67b28e969 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/builtins3.C @@ -0,0 +1,39 @@ +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// +// Special g++ Options: -O2 + +namespace std +{ + extern "C" void abort (void); + extern "C" void *alloca (__SIZE_TYPE__); +} + +int main () +{ + using namespace std; + void *foo; + + foo = alloca (32); + if (!foo) + abort (); + + foo = std::alloca (32); + if (!foo) + abort (); + + foo = ::__builtin_alloca (32); + if (!foo) + abort (); + + return 0; +} + +extern "C" +{ + static void * ::alloca (__SIZE_TYPE__) + { + std::abort (); + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/builtins4.C b/gcc/testsuite/g++.old-deja/g++.other/builtins4.C new file mode 100644 index 00000000000..7118910a27f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/builtins4.C @@ -0,0 +1,39 @@ +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// +// Special g++ Options: -O2 + +namespace std +{ + extern "C" void abort (void); + extern "C" int printf (const char *, ...); +} + +int main () +{ + using namespace std; + + printf ("hello world\n"); + printf ("\n"); + printf ("%s\n", "hello world"); + printf ("%c", '\n'); + std::printf ("hello world\n"); + std::printf ("\n"); + std::printf ("%s\n", "hello world"); + std::printf ("%c", '\n'); + ::__builtin_printf ("hello world\n"); + ::__builtin_printf ("\n"); + ::__builtin_printf ("%s\n", "hello world"); + ::__builtin_printf ("%c", '\n'); + + return 0; +} + +extern "C" +{ + static int ::printf (const char *, ...) + { + std::abort (); + } +} -- 2.30.2