Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > gnu.utils.bug > #2276

ld resolving different types

From Norman Goldstein <normvcr@telus.net>
Newsgroups gnu.utils.bug
Subject ld resolving different types
Date 2020-02-15 16:51 -0800
Message-ID <mailman.946.1581814281.2412.bug-gnu-utils@gnu.org> (permalink)
References <4cb01f16-bfc7-73cc-183c-ad6e8c76863c@telus.net>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

LD version:
    GNU ld version 2.31.1-37.fc30

Platform:
    Linux 5.4.17-100.fc30.x86_64 #1 SMP     x86_64 x86_64 x86_64 GNU/Linux

Compile/Link command:
     gcc tlink.cpp tlink2.cpp -o tlink -lstdc++

The programs compiles and links without warning or error, but resolves 
/extern int foo/ with /double foo/.  The result of running the program 
is, of course, garbage:

foo= -858993459

The program contains only 1 definition for foo (the extern statement is 
a declaration), so the program is not violating the One Definition Rule.

Thank you.



Back to gnu.utils.bug | Previous | Next | Find similar


Thread

ld resolving different types Norman Goldstein <normvcr@telus.net> - 2020-02-15 16:51 -0800

csiph-web