From af0c51ac87ab2a87caa03fa108f0d164987a2764 Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Thu, 28 Mar 2013 11:14:20 -0700 Subject: [GCC 4.8] Initial check-in of GCC 4.8.0 Change-Id: I0719d8a6d0f69b367a6ab6f10eb75622dbf12771 --- gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-2_a.C | 62 ++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-2_a.C (limited to 'gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-2_a.C') diff --git a/gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-2_a.C b/gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-2_a.C new file mode 100644 index 000000000..918c94375 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-2_a.C @@ -0,0 +1,62 @@ +/* { dg-do compile } */ +/* { dg-options "-Wuninitialized -O2" } */ + +typedef long long int64; +void incr (); +bool is_valid (int); +int get_time (); + +class A +{ +public: + A (); + ~A () { + if (I) delete I; + } + +private: + int* I; +}; + +bool get_url (A *); + +class M { + + public: +__attribute__ ((always_inline)) bool GetC (int *c) { + + A details_str; + if (get_url (&details_str)) + { + *c = get_time (); + return true; + } + + return false; + } + + void do_sth(); + void do_sth2(); + + void P (int64 t) + { + int cc; + if (!GetC (&cc)) /* return flag checked properly */ + return; + + if (cc <= 0) /* { dg-bogus "uninitialized" "uninitialized variable warning" } */ + { + this->do_sth(); + return; + } + + do_sth2(); + } +}; + +M* m; +void foo(int x) +{ + m = new M; + m->P(x); +} -- cgit v1.2.3