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: PATCH: Don't allow weak variables in COMMON


   From: Mark Mitchell <mark@codesourcery.com>
   Date: Fri, 24 May 2002 00:49:06 -0700
   
   > Just un-BSS it by initializing it to zero if that is what you want.
   
   Do you mean in the compiler or at user level?
   
   In other words, are you suggesting that the code quoted above is
   actually erroneous, and that the user should write "= 0"?  Or do
   you mean that the front end should have set DECL_INIT to an
   expression for a zero of the proper type?
   
I think the user is in error.  Sorry for being unclear.

I think we should also detect such conflicts and error.
This is because the user is telling us two conflicting
things and it is unwise to try and figure out what the
user meant.

What does this mean?

int x __attribute__((section("data.foo")));

Maybe this attribute came from some macro and the user
applied it by accident to some of his BSS data.

Or maybe he really did mean to put it into this special
section.  What would he like the initial value to be
in such a case since it won't be in the BSS anymore?

This is why I feel it is unwise to try and resolve conflicts
in what the user tells us in these kinds of cases.

I got stung by a bug due to this the other day so I know exactly what
kind of hell it can be to track the problem down.  Especially if you
don't know it is because you've told the compiler two different things
and it didn't at least warn about it.


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