[cfe-dev] no const string consolidation in -O0?

Eli Friedman eli.friedman at gmail.com
Tue Mar 6 02:42:38 PST 2012


On Tue, Mar 6, 2012 at 2:26 AM, Yingshen Yu <yingshen.yu at gmail.com> wrote:
> Hi,
>
> Just spent about an hour to narrow down this.
>
> For the program below. clang 3.1 returns "different" unless you optimize it
> with -O2 or higher.  In gcc 4.2 and VC,  the code always return "same" no
> matter in -O0 or -O2.
>
> I guess this means clang doesn't do const string consolidation by
> default. Is there any switch to make clang do this consolidation in -O0?
>
> Or can Clang dev team can make this consolidate as default?

No... but we should probably fix that.  Pretty sure it's just an
oversight, not intentional.  Please file at llvm.org/bugs/ .

-Eli




More information about the cfe-dev mailing list