[Bug c++/68810] [6 regression] FAIL: g++.dg/cpp0x/constexpr-reinterpret1.C -- test for errors -- -m32

2016-01-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68810

--- Comment #12 from Jakub Jelinek  ---
Author: jakub
Date: Thu Jan 21 20:29:33 2016
New Revision: 232705

URL: https://gcc.gnu.org/viewcvs?rev=232705=gcc=rev
Log:
PR c++/68810
* g++.dg/cpp0x/constexpr-reinterpret1.C: Fix line number that is
expected to generate an error.  

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C

[Bug c++/68810] [6 regression] FAIL: g++.dg/cpp0x/constexpr-reinterpret1.C -- test for errors -- -m32

2016-01-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68810

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug c++/68810] [6 regression] FAIL: g++.dg/cpp0x/constexpr-reinterpret1.C -- test for errors -- -m32

2016-01-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68810

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #11 from Jakub Jelinek  ---
The reason for this is cp_convert_to_pointer doing:
228   if (INTEGRAL_CODE_P (form))
229 {
230   if (TYPE_PRECISION (intype) == POINTER_SIZE)
231 return build1 (CONVERT_EXPR, type, expr);
232   expr = cp_convert (c_common_type_for_size (POINTER_SIZE, 0),
expr,
233  complain);
234   /* Modes may be different but sizes should be the same.  There
235  is supposed to be some integral type that is the same width
236  as a pointer.  */
237   gcc_assert (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr)))
238   == GET_MODE_SIZE (TYPE_MODE (type)));
239 
240   return convert_to_pointer_nofold (type, expr);
241 }

expr is INTEGER_CST 4, so for sizeof (void *) == sizeof (int) targets it
unconditionally creates unfolded CONVERT_EXPR, which will hold the current
input_location at that point (happens to be about right), while for sizeof
(void *) != sizeof (int) targets it goes different path and (what happened to
delayed folding here?) cp_convert actually folds it right away into long int 4L
INTEGER_CST and convert_to_pointer_nofold (regardless of the *_nofold in the
name) actually also folds it into INTEGER_CST 4 with pointer type.
Thus, unless we progress further with actual delayed folding, and/or unless we
introduce also USE_EXPR trees holding uses of constants and decls, we are not
going to resolve this.
So, for GCC6, I think best would be just to move the }:
--- constexpr-reinterpret1.C~   2015-11-14 19:35:49.0 +0100
+++ constexpr-reinterpret1.C2016-01-12 19:52:00.114998687 +0100
@@ -17,8 +17,7 @@ public:
   constexpr static Inner & getInner()
   {
 /* I am surprised this is considered a constexpr */
-return *((Inner *)4);
-  } // { dg-error "reinterpret_cast" "" }
+return *((Inner *)4); } // { dg-error "reinterpret_cast" "" }
 };

 B B::instance;
so that it really doesn't matter where it is reported.  And work more on C++
delayed folding for GCC 7.

[Bug c++/68810] [6 regression] FAIL: g++.dg/cpp0x/constexpr-reinterpret1.C -- test for errors -- -m32

2016-01-02 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68810

Andreas Schwab  changed:

   What|Removed |Added

   Target Milestone|--- |6.0
Summary|FAIL:   |[6 regression] FAIL:
   |g++.dg/cpp0x/constexpr-rein |g++.dg/cpp0x/constexpr-rein
   |terpret1.C  -- test for |terpret1.C  -- test for
   |errors -- -m32  |errors -- -m32