This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Making fold-const sane WRT symbol visibilities
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Jan Hubicka <hubicka at ucw dot cz>, Andreas Schwab <schwab at suse dot de>, "Joseph S. Myers" <joseph at codesourcery dot com>, Richard Biener <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org, law at redhat dot com
- Date: Mon, 14 Jul 2014 17:12:55 +0200
- Subject: Re: [RFC] Making fold-const sane WRT symbol visibilities
- Authentication-results: sourceware.org; auth=none
- References: <20140624055954 dot GA27803 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1406240927510 dot 29270 at zhemvz dot fhfr dot qr> <20140624182540 dot GC5997 at atrey dot karlin dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1406251006580 dot 29270 at zhemvz dot fhfr dot qr> <Pine dot LNX dot 4 dot 64 dot 1406251545040 dot 12113 at digraph dot polyomino dot org dot uk> <20140713221428 dot GA15955 at kam dot mff dot cuni dot cz> <mvmion0pcjn dot fsf at hawking dot suse dot de> <20140714083618 dot GB3386 at kam dot mff dot cuni dot cz> <53C3E02A dot 2090803 at redhat dot com> <20140714140109 dot GL31640 at tucnak dot redhat dot com>
> 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