This is the mail archive of the gcc@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]

[3.3/3.4] wrong handling of "extern const" variables


Hello!

The following patch which was installed at 2003-04-07 to fix opt/8634

  http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00533.html

exhibits a problem in the handling of "extern const" variables.

--- foo1.c ---
const char bar[] = "haha";
--- foo1.c ---

Compiling that with 3.3 sets RTX_UNCHANGING_P in explow.c/maybe_set_unchanging
for bar because TREE_STATIC is true. Since RTX_UNCHANGING_P is true, bar is
placed in the text section on my target.

--- foo2.c ---
extern const char bar[];
const char *foo(void)
{
  return bar;
}
--- foo2.c ---

RTX_UNCHANGING_P isn't set in explow.c/maybe_set_unchanging for bar because
TREE_STATIC is false. Thus bar is assumed to be in the data section on my
target.

This looks like a bug but I don't know what excatly the bug is.

Regards,
Gunther Nikl


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