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]

Re: [RFC] Making fold-const sane WRT symbol visibilities


> On Mon, Jul 14, 2014 at 09:50:34AM -0400, Jason Merrill wrote:
> > >>/daten/aranym/gcc/gcc-20140714/gcc/testsuite/g++.dg/cpp0x/static_assert9.C:5:1: error: non-constant condition for static assertion
> > >>/daten/aranym/gcc/gcc-20140714/gcc/testsuite/g++.dg/cpp0x/static_assert9.C:5:1: error: '(f != 0u)' is not a constant expression
> > >
> > >Ah, sorry, missed this one.  I think the error is correct (based on earlier discussion we can
> > >not really expect addresses of symbols to be non-NULL), so I would just update the testcase?
> > 
> > Hmm.  I think the C++ standard says this is constant, and of course whether
> > an expression is constant is more significant in C++ because of templates
> > and constexpr.  clang doesn't give this error, EDG does.
> > 
> > For C++, my inclination would be to say that if a symbol is declared weak,
> > it needs to be declared weak before the first use, just like inline
> > functions.
> 
> I'd say that even for C we should require that, and thus for
> non-weak symbols expect they are non-NULL, unless
> -fno-delete-null-pointer-checks tells us not to.

OK, I suppose we can't go without bit of code duplication here (at parsing time and with symtab built).
Will prepare patch for this.

Honza
> 	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]