Looking for some help with GCC 6 and bad code generation

Zan Lynx zlynx@acm.org
Thu Apr 21 01:37:00 GMT 2016


On 4/20/2016 7:18 PM, Andrew Pinski wrote:
> On Thu, Apr 21, 2016 at 9:11 AM, Zan Lynx <zlynx@acm.org> wrote:
>> I would like someone to look at this and tell me this is an already
>> fixed bug. Or that recent GCC patches may have fixed it. :-)
>>
>> Or it would also be great to get some advice on building a reproducer
>> without needing to include many megabytes of proprietary code plus Boost.
>>
>> I've been using Fedora 24 Alpha and of course I've somehow managed to
>> write some C++ code even more confusing for GCC than Firefox. Heh.
>>
>> The problem is a crash when std::string tries to free memory from a
>> temporary std::string that was bound to a const reference.
>>
>> And it only crashes when I pass -O2 or -O3 and the -fprofile-generate flags.
>
> What is the return type of URLDatabaseReader_1::identifier() ?
> Also does -fsanitize=undefined say anything about your code?
>
> Thanks,
> Andrew
>
const std::string& URLDatabaseReader_1::identifier()
{
     static const std::string id("esct");
     return id;
}

And I'll give sanitize a try.

-- 
                 Knowledge is Power -- Power Corrupts
                         Study Hard -- Be Evil



More information about the Gcc mailing list