re PR sanitizer/70342 (g++ -fsanitize=undefined never finishes compiling (>24h) in...
authorMarek Polacek <polacek@redhat.com>
Fri, 29 Apr 2016 12:32:45 +0000 (12:32 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 29 Apr 2016 12:32:45 +0000 (12:32 +0000)
PR sanitizer/70342
* fold-const.c (tree_single_nonzero_warnv_p): For TARGET_EXPR, use
TARGET_EXPR_SLOT as a base.

* g++.dg/ubsan/null-7.C: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r235637

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ubsan/null-7.C [new file with mode: 0644]

index b98598fa394e1e61162bef90d5779ceee88a28f3..a6b6804577654cae6b5a386c47243f46c345455b 100644 (file)
@@ -1,3 +1,10 @@
+2016-04-29  Marek Polacek  <polacek@redhat.com>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/70342
+       * fold-const.c (tree_single_nonzero_warnv_p): For TARGET_EXPR, use
+       TARGET_EXPR_SLOT as a base.
+
 2016-04-29  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * config/arc/arc.md (*loadqi_update): Replace use of 'rI'
index 69749a85231ef2eff03a7cbf179a01182d80086f..4aa24125440270e4759b2bb9107db2cf5c7f2213 100644 (file)
@@ -13534,6 +13534,9 @@ tree_single_nonzero_warnv_p (tree t, bool *strict_overflow_p)
        if (!DECL_P (base))
          base = get_base_address (base);
 
+       if (base && TREE_CODE (base) == TARGET_EXPR)
+         base = TARGET_EXPR_SLOT (base);
+
        if (!base)
          return false;
 
index 7dfa23db3c132fc8613896a26175a8e0325897a3..93e89d98fb772975d68470a90f2971ec377fab73 100644 (file)
@@ -1,3 +1,8 @@
+2016-04-29  Marek Polacek  <polacek@redhat.com>
+
+       PR sanitizer/70342
+       * g++.dg/ubsan/null-7.C: New test.
+
 2016-04-29  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        PR/69089
diff --git a/gcc/testsuite/g++.dg/ubsan/null-7.C b/gcc/testsuite/g++.dg/ubsan/null-7.C
new file mode 100644 (file)
index 0000000..8284bc7
--- /dev/null
@@ -0,0 +1,24 @@
+// PR sanitizer/70342
+// { dg-do compile }
+// { dg-options "-fsanitize=null" }
+
+class A {};
+class B {
+public:
+  B(A);
+};
+class C {
+public:
+  C operator<<(B);
+};
+class D {
+  D(const int &);
+  C m_blackList;
+};
+D::D(const int &) {
+  m_blackList << A() << A() << A() << A() << A() << A() << A() << A() << A()
+              << A() << A() << A() << A() << A() << A() << A() << A() << A()
+              << A() << A() << A() << A() << A() << A() << A() << A() << A()
+              << A() << A() << A() << A() << A() << A() << A() << A() << A()
+              << A() << A() << A() << A() << A() << A() << A() << A() << A();
+}