public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39565]  New: Static variable leaves undefined symbol in object file
@ 2009-03-26 17:51 edmar at freescale dot com
  2009-03-27  9:20 ` [Bug target/39565] " rguenth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: edmar at freescale dot com @ 2009-03-26 17:51 UTC (permalink / raw)
  To: gcc-bugs

Compiling the test case, produces undefined symbols codestrs_4 and codestrs_8,
which will result in a link error.

If the static is dropped or one of the cases in the switch statement is
removed, the object file does not have undefined symbols.


Test case:

static const union codestrs_t_4 {
  struct {
    char str_2[sizeof ("Illegal opcode")];
  };
  char str[0];
} codestrs_4 = { {"Illegal opcode"} };

static const union codestrs_t_8 {
  struct {
    char str_12[sizeof ("Integer divide by zero")];
  };
  char str[0];
} codestrs_8 = { {"Integer divide by zero"} };

const char *
psiginfo (int pinfo)
{
  const char *base = ((void *)0);

  switch (pinfo)
    {
    case 4: base = codestrs_4.str; break;
    case 8: base = codestrs_8.str; break;
    }
  return base;
 }


Compiled with:
gcc -O2 -c
objdump -t 


Result:
cases.o:     file format elf32-powerpc

SYMBOL TABLE:
00000000 l    df *ABS*  00000000 cases.c
00000000 l    d  .text  00000000 .text
00000000 l    d  .data  00000000 .data
00000000 l    d  .bss   00000000 .bss
00000000 l     O .data  00000014 CSWTCH.1
00000000 l    d  .note.GNU-stack        00000000 .note.GNU-stack
00000000 l    d  .comment       00000000 .comment
00000000 l    d  .gnu.attributes        00000000 .gnu.attributes
00000000 g     F .text  00000024 psiginfo
00000000         *UND*  00000000 codestrs_4
00000000         *UND*  00000000 codestrs_8


-- 
           Summary: Static variable leaves undefined symbol in object file
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: edmar at freescale dot com
 GCC build triplet: powerpc-unknown-linux-gnu
  GCC host triplet: powerpc-unknown-linux-gnu
GCC target triplet: powerpc-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39565


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/39565] Static variable leaves undefined symbol in object file
  2009-03-26 17:51 [Bug c/39565] New: Static variable leaves undefined symbol in object file edmar at freescale dot com
@ 2009-03-27  9:20 ` rguenth at gcc dot gnu dot org
  2009-03-27 15:01 ` edmar at freescale dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-03-27  9:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-03-27 09:19 -------
I get

t.o:     file format elf32-i386

SYMBOL TABLE:
00000000 l    df *ABS*  00000000 t.c
00000000 l    d  .text  00000000 .text
00000000 l    d  .data  00000000 .data
00000000 l    d  .bss   00000000 .bss
00000000 l     O .rodata        0000000f codestrs_4
0000000f l     O .rodata        00000017 codestrs_8
00000000 l    d  .rodata        00000000 .rodata
00000000 l    d  .note.GNU-stack        00000000 .note.GNU-stack
00000000 l    d  .comment       00000000 .comment
00000000 g     F .text  00000022 psiginfo


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39565


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/39565] Static variable leaves undefined symbol in object file
  2009-03-26 17:51 [Bug c/39565] New: Static variable leaves undefined symbol in object file edmar at freescale dot com
  2009-03-27  9:20 ` [Bug target/39565] " rguenth at gcc dot gnu dot org
@ 2009-03-27 15:01 ` edmar at freescale dot com
  2009-04-28 23:44 ` anmol at freescale dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: edmar at freescale dot com @ 2009-03-27 15:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from edmar at freescale dot com  2009-03-27 15:01 -------
I noticed that too. On x86_64 there is no undefined symbol either.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39565


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/39565] Static variable leaves undefined symbol in object file
  2009-03-26 17:51 [Bug c/39565] New: Static variable leaves undefined symbol in object file edmar at freescale dot com
  2009-03-27  9:20 ` [Bug target/39565] " rguenth at gcc dot gnu dot org
  2009-03-27 15:01 ` edmar at freescale dot com
@ 2009-04-28 23:44 ` anmol at freescale dot com
  2009-04-29  8:35 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anmol at freescale dot com @ 2009-04-28 23:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from anmol at freescale dot com  2009-04-28 23:43 -------

 I verified with native GCC on target: powerpc-unknown-linux-gnu on:

 gcc version 4.5.0 20090423 (experimental) [trunk revision 146648] (GCC)
 gcc version 4.4.1 20090424 (prerelease) [gcc-4_4-branch revision 146746] (GCC)

 that this is no longer a problem.

 I have submitted a testcase for the regression suite; please see:

 http://gcc.gnu.org/ml/gcc-patches/2009-04/msg02296.html



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39565


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/39565] Static variable leaves undefined symbol in object file
  2009-03-26 17:51 [Bug c/39565] New: Static variable leaves undefined symbol in object file edmar at freescale dot com
                   ` (2 preceding siblings ...)
  2009-04-28 23:44 ` anmol at freescale dot com
@ 2009-04-29  8:35 ` rguenth at gcc dot gnu dot org
  2009-04-29 12:06 ` bje at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-29  8:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-04-29 08:34 -------
Subject: Bug 39565

Author: rguenth
Date: Wed Apr 29 08:34:21 2009
New Revision: 146928

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146928
Log:
2009-04-29  Anmol P. Paralkar  <anmol@freescale.com>

        PR target/39565
        * gcc.dg/pr39565.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/pr39565.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39565


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/39565] Static variable leaves undefined symbol in object file
  2009-03-26 17:51 [Bug c/39565] New: Static variable leaves undefined symbol in object file edmar at freescale dot com
                   ` (3 preceding siblings ...)
  2009-04-29  8:35 ` rguenth at gcc dot gnu dot org
@ 2009-04-29 12:06 ` bje at gcc dot gnu dot org
  2009-04-29 14:55 ` hjl at gcc dot gnu dot org
  2009-04-29 17:29 ` anmol at freescale dot com
  6 siblings, 0 replies; 8+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-04-29 12:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from bje at gcc dot gnu dot org  2009-04-29 12:06 -------
I think this PR can now be closed.


-- 

bje at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39565


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/39565] Static variable leaves undefined symbol in object file
  2009-03-26 17:51 [Bug c/39565] New: Static variable leaves undefined symbol in object file edmar at freescale dot com
                   ` (4 preceding siblings ...)
  2009-04-29 12:06 ` bje at gcc dot gnu dot org
@ 2009-04-29 14:55 ` hjl at gcc dot gnu dot org
  2009-04-29 17:29 ` anmol at freescale dot com
  6 siblings, 0 replies; 8+ messages in thread
From: hjl at gcc dot gnu dot org @ 2009-04-29 14:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hjl at gcc dot gnu dot org  2009-04-29 14:55 -------
Subject: Bug 39565

Author: hjl
Date: Wed Apr 29 14:54:54 2009
New Revision: 146972

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146972
Log:
2009-04-29  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline:
        2009-04-29  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/39941
        * gcc.c-torture/compile/pr39941.c: New testcase.

        2009-04-29  Anmol P. Paralkar  <anmol@freescale.com>

        PR target/39565
        * gcc.dg/pr39565.c: New testcase.

        2009-04-28  Richard Guenther  <rguenther@suse.de>

        PR middle-end/39937
        * gfortran.fortran-torture/compile/pr39937.f: New testcase.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr39941.c
      - copied unchanged from r146971,
trunk/gcc/testsuite/gcc.c-torture/compile/pr39941.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr39565.c
      - copied unchanged from r146971, trunk/gcc/testsuite/gcc.dg/pr39565.c
   
branches/gcc-4_4-branch/gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f
      - copied unchanged from r146971,
trunk/gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39565


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/39565] Static variable leaves undefined symbol in object file
  2009-03-26 17:51 [Bug c/39565] New: Static variable leaves undefined symbol in object file edmar at freescale dot com
                   ` (5 preceding siblings ...)
  2009-04-29 14:55 ` hjl at gcc dot gnu dot org
@ 2009-04-29 17:29 ` anmol at freescale dot com
  6 siblings, 0 replies; 8+ messages in thread
From: anmol at freescale dot com @ 2009-04-29 17:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from anmol at freescale dot com  2009-04-29 17:29 -------

 Respun testcase per advice from Joseph S. Myers:

 http://gcc.gnu.org/ml/gcc-patches/2009-04/msg02363.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39565


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-29 17:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-26 17:51 [Bug c/39565] New: Static variable leaves undefined symbol in object file edmar at freescale dot com
2009-03-27  9:20 ` [Bug target/39565] " rguenth at gcc dot gnu dot org
2009-03-27 15:01 ` edmar at freescale dot com
2009-04-28 23:44 ` anmol at freescale dot com
2009-04-29  8:35 ` rguenth at gcc dot gnu dot org
2009-04-29 12:06 ` bje at gcc dot gnu dot org
2009-04-29 14:55 ` hjl at gcc dot gnu dot org
2009-04-29 17:29 ` anmol at freescale dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).