Commit 7c75a2a3 by Sandra Loosemore

Add -fdelete-null-pointer-checks to some C++ testcases.

These testcases were failing on nios2-elf, which defaults to
-fno-delete-null-pointer-checks.

2020-01-24  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/testsuite/
	* g++.dg/cpp0x/constexpr-odr1.C: Add -fdelete-null-pointer-checks.
	* g++.dg/cpp0x/constexpr-odr2.C: Likewise.
	* g++.dg/cpp0x/nontype4.C: Likewise.
	* g++.dg/cpp1y/constexpr-new.C: Likewise.
	* g++.dg/cpp1y/new1.C: Likewise.
	* g++.dg/cpp1y/new2.C: Likewise.
	* g++.dg/cpp2a/constexpr-dynamic11.C: Likewise.
	* g++.dg/cpp2a/constexpr-dynamic17.C: Likewise.
	* g++.dg/cpp2a/constexpr-dynamic4.C: Likewise.
	* g++.dg/cpp2a/constexpr-new1.C: Likewise.
	* g++.dg/cpp2a/constexpr-new10.C: Likewise.
	* g++.dg/cpp2a/constexpr-new2.C: Likewise.
	* g++.dg/cpp2a/constexpr-new3.C: Likewise.
	* g++.dg/cpp2a/constexpr-new4.C: Likewise.
	* g++.dg/cpp2a/constexpr-new8.C: Likewise.
	* g++.dg/cpp2a/constexpr-new9.C: Likewise.
	* g++.dg/cpp2a/nontype-class1.C: Likewise.
parent 28a5d5c3
2020-01-24 Sandra Loosemore <sandra@codesourcery.com>
* g++.dg/cpp0x/constexpr-odr1.C: Add -fdelete-null-pointer-checks.
* g++.dg/cpp0x/constexpr-odr2.C: Likewise.
* g++.dg/cpp0x/nontype4.C: Likewise.
* g++.dg/cpp1y/constexpr-new.C: Likewise.
* g++.dg/cpp1y/new1.C: Likewise.
* g++.dg/cpp1y/new2.C: Likewise.
* g++.dg/cpp2a/constexpr-dynamic11.C: Likewise.
* g++.dg/cpp2a/constexpr-dynamic17.C: Likewise.
* g++.dg/cpp2a/constexpr-dynamic4.C: Likewise.
* g++.dg/cpp2a/constexpr-new1.C: Likewise.
* g++.dg/cpp2a/constexpr-new10.C: Likewise.
* g++.dg/cpp2a/constexpr-new2.C: Likewise.
* g++.dg/cpp2a/constexpr-new3.C: Likewise.
* g++.dg/cpp2a/constexpr-new4.C: Likewise.
* g++.dg/cpp2a/constexpr-new8.C: Likewise.
* g++.dg/cpp2a/constexpr-new9.C: Likewise.
* g++.dg/cpp2a/nontype-class1.C: Likewise.
2020-01-24 Jason Merrill <jason@redhat.com> 2020-01-24 Jason Merrill <jason@redhat.com>
* lib/target-supports.exp (check_effective_target_unsigned_char): * lib/target-supports.exp (check_effective_target_unsigned_char):
......
// PR c++/92062 - ODR-use ignored for static member of class template. // PR c++/92062 - ODR-use ignored for static member of class template.
// { dg-do run { target c++11 } } // { dg-do run { target c++11 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
template<int> struct A { template<int> struct A {
static const bool x; static const bool x;
......
// PR c++/92062 - ODR-use ignored for static member of class template. // PR c++/92062 - ODR-use ignored for static member of class template.
// { dg-do run { target c++11 } } // { dg-do run { target c++11 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
template<int> struct A { template<int> struct A {
static const bool x; static const bool x;
......
// PR c++/56428 // PR c++/56428
// { dg-do compile { target c++11 } } // { dg-do compile { target c++11 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct A { }; struct A { };
......
// { dg-do compile { target c++14 } } // { dg-do compile { target c++14 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
constexpr int *f4(bool b) { constexpr int *f4(bool b) {
if (b) { if (b) {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-cddce-details" } */ /* { dg-options "-O2 -fdump-tree-cddce-details" } */
// { dg-additional-options "-fdelete-null-pointer-checks" }
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -std=c++17 -fdump-tree-cddce-details" } */ /* { dg-options "-O2 -std=c++17 -fdump-tree-cddce-details" } */
/* { dg-additional-options "-fdelete-null-pointer-checks" } */
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
......
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr. // PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
// dynamic_cast in a constructor. // dynamic_cast in a constructor.
// [class.cdtor]#6: "If the operand of the dynamic_cast refers to the object // [class.cdtor]#6: "If the operand of the dynamic_cast refers to the object
......
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr. // PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
// dynamic_cast in a constructor. // dynamic_cast in a constructor.
// [class.cdtor]#6: "If the operand of the dynamic_cast refers to the object // [class.cdtor]#6: "If the operand of the dynamic_cast refers to the object
......
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr. // PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
// From clang's constant-expression-cxx2a.cpp. // From clang's constant-expression-cxx2a.cpp.
......
// P0784R7 // P0784R7
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct S { constexpr S () : s (5) {} constexpr S (int x) : s (x) {} int s; }; struct S { constexpr S () : s (5) {} constexpr S (int x) : s (x) {} int s; };
......
// PR c++/91369 // PR c++/91369
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct S { struct S {
constexpr S (int* i) : s{i} {} constexpr S (int* i) : s{i} {}
......
// P0784R7 // P0784R7
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
template <int N> template <int N>
constexpr bool constexpr bool
......
// P0784R7 // P0784R7
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
constexpr int * constexpr int *
f1 () f1 ()
......
// P0784R7 // P0784R7
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct S struct S
{ {
......
// PR c++/91369 // PR c++/91369
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct A { struct A {
constexpr A () : p{new int} {} constexpr A () : p{new int} {}
......
// PR c++/91369 // PR c++/91369
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct S { struct S {
constexpr S (int *i) : i{i} {} constexpr S (int *i) : i{i} {}
......
// { dg-do compile { target c++2a } } // { dg-do compile { target c++2a } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct A struct A
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment