Re: behavior-preserving optimization in C, was compiler bugs

Ian Lance Taylor <ian@airs.com>
Mon, 25 May 2009 18:45:14 -0700

          From comp.compilers

Related articles
[24 earlier articles]
Re: behavior-preserving optimization in C, was compiler bugs anton@mips.complang.tuwien.ac.at (2009-05-21)
Re: behavior-preserving optimization in C, was compiler bugs bear@sonic.net (Ray) (2009-05-21)
Re: behavior-preserving optimization in C, was compiler bugs Jan.Vorbrueggen@thomson.net (=?ISO-8859-15?Q?Jan_Vorbr=FCggen?=) (2009-05-22)
Re: behavior-preserving optimization in C, was compiler bugs gneuner2@comcast.net (George Neuner) (2009-05-24)
Re: behavior-preserving optimization in C, was compiler bugs DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-05-25)
Re: behavior-preserving optimization in C, was compiler bugs anton@mips.complang.tuwien.ac.at (2009-05-25)
Re: behavior-preserving optimization in C, was compiler bugs ian@airs.com (Ian Lance Taylor) (2009-05-25)
Re: behavior-preserving optimization in C, was compiler bugs gneuner2@comcast.net (George Neuner) (2009-05-25)
Re: behavior-preserving optimization in C, was compiler bugs DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-05-29)
Re: behavior-preserving optimization in C, was compiler bugs dave.thompson2@verizon.net (David Thompson) (2009-06-15)
| List of all articles for this month |

From: Ian Lance Taylor <ian@airs.com>
Newsgroups: comp.compilers
Date: Mon, 25 May 2009 18:45:14 -0700
Organization: Compilers Central
References: 09-04-072 09-04-086 09-05-010 09-05-022 09-05-028 09-05-038 09-05-039 09-05-050 09-05-055 09-05-065 09-05-069 09-05-073 09-05-087 09-05-110 09-05-119
Keywords: linker
Posted-Date: 28 May 2009 17:35:54 EDT

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:


> What I expected is that the linker complains about duplicate symbols
> (irrespective of optimization level). I was very surprised that GNU
> ld produced only warnings for the example given, and that linking
> succeeded.


The linker is acting correctly. When GCC sees an uninitialized
definition, it emits a common symbol. As our esteemed moderator says,
that is a historical artifact. GCC supports the -fno-common option,
q.v., to change this behaviour.


Ian



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.