Backport PRs 42398, 42439, 42447, 42462, 42508, 42555, 42559, 42570

Backport tests from mainline

2010-01-07  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2010-01-06  Richard Guenther  <rguenther@suse.de>

	* gcc.c-torture/compile/pr42632.c: New testcase.

	2010-01-05  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42462
	* g++.dg/torture/pr42462.C: New test.

	2010-01-05  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/42508
	* g++.dg/opt/pr42508.C: New test.

	2010-01-04  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42398
	* gcc.c-torture/compile/pr42398.c: New test.

	2010-01-04  Jason Merrill  <jason@redhat.com>

	PR c++/42555
	* g++.dg/ext/attrib35.C: New.

	2010-01-01  Richard Guenther  <rguenther@suse.de>

	PR c/42570
	* gcc.c-torture/execute/pr42570.c: New testcase.

	2010-01-01  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42559
	* gcc.c-torture/compile/pr42559.c: New testcase.

	2009-12-30  Joseph Myers  <joseph@codesourcery.com>

	PR c/42439
	* gcc.dg/bitfld-19.c: New test.

	2009-12-28  Jason Merrill  <jason@redhat.com>

	PR c++/42447
	* g++.dg/template/array21.C: New.

From-SVN: r155713
This commit is contained in:
H.J. Lu 2010-01-07 22:22:32 +00:00 committed by H.J. Lu
parent 8e3f0db6c2
commit 1b42dd98f0
10 changed files with 246 additions and 0 deletions

View File

@ -1,3 +1,50 @@
2010-01-07 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline:
2010-01-06 Richard Guenther <rguenther@suse.de>
* gcc.c-torture/compile/pr42632.c: New testcase.
2010-01-05 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42462
* g++.dg/torture/pr42462.C: New test.
2010-01-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/42508
* g++.dg/opt/pr42508.C: New test.
2010-01-04 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42398
* gcc.c-torture/compile/pr42398.c: New test.
2010-01-04 Jason Merrill <jason@redhat.com>
PR c++/42555
* g++.dg/ext/attrib35.C: New.
2010-01-01 Richard Guenther <rguenther@suse.de>
PR c/42570
* gcc.c-torture/execute/pr42570.c: New testcase.
2010-01-01 Richard Guenther <rguenther@suse.de>
PR middle-end/42559
* gcc.c-torture/compile/pr42559.c: New testcase.
2009-12-30 Joseph Myers <joseph@codesourcery.com>
PR c/42439
* gcc.dg/bitfld-19.c: New test.
2009-12-28 Jason Merrill <jason@redhat.com>
PR c++/42447
* g++.dg/template/array21.C: New.
2010-01-07 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline

View File

@ -0,0 +1,19 @@
// { dg-do compile { target i*86-*-* x86_64-*-* } }
// { dg-options "-O3 -msse2" }
// You can make NON-template typedefs with a large alignment.
typedef double AlignedDoubleType __attribute__((aligned(16)));
template <typename RealType>
RealType f(const RealType* p)
{
// But if you use a template parameter it complains.
typedef RealType AlignedRealType __attribute__((aligned(16)));
return p[0];
}
double f2(const double* p)
{
return f<double>(p);
}

View File

@ -0,0 +1,33 @@
// PR tree-optimization/42508
// { dg-do run }
// { dg-options "-O1 -fipa-sra" }
extern "C" void abort ();
int v[10], vidx;
struct A
{
A *prev;
int i;
~A()
{
v[vidx++] = i;
delete prev;
}
};
int
main ()
{
A *a1 = new A ();
A *a2 = new A ();
a1->prev = 0;
a1->i = 1;
a2->prev = a1;
a2->i = 2;
delete a2;
if (vidx != 2 || v[0] != 2 || v[1] != 1)
abort ();
return 0;
}

View File

@ -0,0 +1,50 @@
// PR c++/42447
template<int>
void* get(int);
template<typename>
struct unique_ptr;
template<typename _Tp>
struct unique_ptr<_Tp[]>
{
typedef int __tuple_type;
void*
get() const
{ return ::get<0>(_M_t); }
__tuple_type _M_t;
};
template <typename T> class dynamic_dispatch;
template <typename TC>
struct dynamic_dispatch<void (TC::*)(int&)>
{
struct entry { };
unique_ptr<entry[]> m_Start;
template <typename UC>
void attach_handler(void (UC::*m)(int&))
{
entry* p = 0;
do {
} while(--p != m_Start.get());
}
};
template <typename TC>
class request_dispatcher
: private dynamic_dispatch<void (TC::*)(int&)>
{ request_dispatcher(); };
struct file_reader
{
void execute_command(int&);
};
template <>
request_dispatcher<file_reader>::request_dispatcher()
{ this->attach_handler(&file_reader::execute_command); }

View File

@ -0,0 +1,47 @@
/* { dg-do run } */
#define INLINE inline __attribute__((always_inline))
extern "C" void abort (void);
template<class> struct Foo {
inline bool isFalse() { return false; }
template <bool> void f1() {}
template <bool> INLINE void f2() { f1<false>(); }
template <bool> void f3() { f2<false>(); }
template <bool> INLINE void f4() { f3<false>(); }
int exec2();
void execute();
inline void unused();
};
template<class T> inline void Foo<T>::unused() {
f4<true>();
}
static int counter = 0;
template<class T> int Foo<T>::exec2() {
static void* table[2] = { &&begin, &&end };
if (counter++ > 10)
return 0;
goto *(table[0]);
begin:
if (isFalse()) f1<false>();
end:
return 1;
}
template<class T> void Foo<T>::execute() {
int r = 1;
while (r) { r = exec2(); }
}
template class Foo<int>;
int main() {
Foo<int> c;
c.execute();
if (counter < 10)
abort ();
return 0;
}

View File

@ -0,0 +1,6 @@
int ptrace_setregs(void)
{
union { unsigned int l; int t; } __gu_tmp;
__asm__ __volatile__("" : "=r" (__gu_tmp.l));
return __gu_tmp.t;
}

View File

@ -0,0 +1,8 @@
void jumpfunc(int copy, void *p)
{
void *l = &&jumplabel;
if (copy)
__builtin___memcpy_chk (p, l, 128, __builtin_object_size (p, 0));
jumplabel:
return;
}

View File

@ -0,0 +1,16 @@
static inline __attribute__((always_inline)) int
__pskb_trim(void)
{
return ___pskb_trim();
}
static inline __attribute__((always_inline))
int pskb_trim(void)
{
return __pskb_trim();
}
int ___pskb_trim(void)
{
pskb_trim();
return 0;
}

View File

@ -0,0 +1,9 @@
typedef unsigned char uint8_t;
uint8_t foo[1][0];
extern void abort (void);
int main()
{
if (sizeof (foo) != 0)
abort ();
return 0;
}

View File

@ -0,0 +1,11 @@
/* Test for bit-field widths not integer constant expressions but
folding to integer constants: PR 42439. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
void
f (void)
{
const int m = 1;
((void)(sizeof(struct { int i:!!m; })));
}