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

[Bug c/14141] New: static functions incorrectly generate multiple function descriptors


the 64 bit compiler is only used to generate kernels for linux (the particular
kernel I debugged this on is 2.6.3-rc1-pa2) so I don't have a user level
compileable example.

The problem arises because a particular piece of code in mm/shmap.c has a
function pointer comparison:

if (inode->i_op->truncate == shmem_truncate) 

Which is always evaluating false.  (shmem_truncate is a static function in shmem.c)

When I check, the Elf64_Fptr for each is different, but the address of the
function is the same.  hppa64 is supposed to have the OPD rule where there's
only one function descriptor per function, so we can evaluate this comparison by
comparing the addresses of the function descriptors.

The value of the function descriptor is assigned like this later in the same file:

static struct inode_operations shmem_symlink_inode_operations = {
        .truncate       = shmem_truncate,
        .readlink       = shmem_readlink,
        .follow_link    = shmem_follow_link,
};


As a test, if the function shmem_truncate is made unstatic, the comparison does
work successfully.

-- 
           Summary: static functions incorrectly generate multiple function
                    descriptors
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jejb at steeleye dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: hppa-linux
  GCC host triplet: hppa-linux
GCC target triplet: hppa64-linux


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


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