This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 07/18/2016 11:51 AM, Jason Merrill wrote:
On 07/06/2016 06:20 PM, Martin Sebor wrote:@@ -2911,6 +2923,14 @@ cxx_eval_indirect_ref (const constexpr_ctx *ctx, tree t,if (*non_constant_p)return t;+ if (integer_zerop (op0))+ {+ if (!ctx->quiet)+ error ("dereferencing a null pointer");+ *non_constant_p = true;+ return t;+ }I'm skeptical of checking this here, since *p is valid for null p; &*p is even a constant expression. And removing this hunk doesn't seem to break any of your tests. OK with that hunk removed.
With it removed the constexpr-nullptr-2.C test fails on line 64:constexpr const int *pi0 = &pa2->pa1->pa0->i; // { dg-error "null pointer|not a constant" }
Here, pa2 and pa1 are non-null but pa0 is null. Martin
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |