diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2015-11-09 22:40:44 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2015-11-09 22:40:44 +0000 |
commit | a91c72e2141bbad97e7017a467d80ae0cdcd8eaf (patch) | |
tree | 753b3f8e319e891e75281afc0e55d037439842a6 /gcc | |
parent | 374d022552a1aa11ad0a53ec635255d09f365289 (diff) | |
download | gcc-a91c72e2141bbad97e7017a467d80ae0cdcd8eaf.zip gcc-a91c72e2141bbad97e7017a467d80ae0cdcd8eaf.tar.gz gcc-a91c72e2141bbad97e7017a467d80ae0cdcd8eaf.tar.bz2 |
re PR middle-end/68259 ([sso] tree checking failure in reverse_storage_order_for_component_p, at tree.h:4392)
PR middle-end/68259
* tree.h (reverse_storage_order_for_component_p) <COMPONENT_REF>:
Check that the type of the first operand is an aggregate type.
From-SVN: r230056
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ubsan/pr68259.C | 54 | ||||
-rw-r--r-- | gcc/tree.h | 5 |
4 files changed, 67 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1f513ec..3c764de 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-11-09 Eric Botcazou <ebotcazou@adacore.com> + + PR middle-end/68259 + * tree.h (reverse_storage_order_for_component_p) <COMPONENT_REF>: + Check that the type of the first operand is an aggregate type. + 2015-11-09 Nathan Sidwell <nathan@codesourcery.com> * omp-low.c: Fix some OpenACC comment typos. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 37ce460..d5942e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-11-09 Eric Botcazou <ebotcazou@adacore.com> + + * g++.dg/ubsan/pr68259.C: New test. + 2015-11-09 Uros Bizjak <ubizjak@gmail.com> * g++.dg/cilk-plus/CK/pr66326.cc: Do not include cilk.h. diff --git a/gcc/testsuite/g++.dg/ubsan/pr68259.C b/gcc/testsuite/g++.dg/ubsan/pr68259.C new file mode 100644 index 0000000..5137edd --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr68259.C @@ -0,0 +1,54 @@ +// PR middle-end/68259
+
+// { dg-do compile }
+// { dg-options "-fsanitize=undefined -w" }
+
+namespace std {
+ template < typename _Tp > class allocator { };
+ template < typename _Tp, typename _Alloc
+= std::allocator < _Tp >
+>class vector {
+ public:
+typedef _Tp value_type;
+ void push_back (const value_type & __x) { }
+ };
+}
+class Foo;
+class FooBar {
+public:
+Foo * primitive_context;
+ FooBar () { }
+ FooBar (const FooBar & pnhp);
+};
+template < class KEY, class CONTENT > class AVLTreeNode { };
+template < class KEY, class CONTENT > class FooTree final
+{
+ FooBar insertPrimitive ();
+public:
+AVLTreeNode < KEY, CONTENT > *seek_no_lock (const KEY & key) { }
+ void primitive_patterns ( std::vector < FooBar > &patterns);
+};
+template < class KEY, class CONTENT > void FooTree < KEY,
+ CONTENT >::primitive_patterns ( std::vector <FooBar > &patterns)
+{
+ patterns.push_back (insertPrimitive());
+}
+template < class KEY, class CONTENT >
+FooBar FooTree < KEY, CONTENT >::insertPrimitive ()
+{
+ FooBar place;
+ seek_no_lock (place.primitive_context);
+ return place;
+}
+class ManuverResults { };
+class opc_info_t
+{
+public:
+FooTree < Foo *, ManuverResults > *primitivecache;
+};
+static void
+do_optical_prox_corr_tsafe (opc_info_t * opc_info)
+{
+ std::vector < FooBar > patterns;
+ opc_info->primitivecache->primitive_patterns (patterns);
+}
@@ -4387,8 +4387,9 @@ reverse_storage_order_for_component_p (tree t) { case ARRAY_REF: case COMPONENT_REF: - /* ??? Fortran can take COMPONENT_REF of a void type. */ - return !VOID_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0))) + /* ??? Fortran can take COMPONENT_REF of a VOID_TYPE. */ + /* ??? UBSan can take COMPONENT_REF of a REFERENCE_TYPE. */ + return AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0))) && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (TREE_OPERAND (t, 0))); case BIT_FIELD_REF: |