Bug 154535 - Workaround for ICE in GCC 4.8 appeared in r196846.
Summary: Workaround for ICE in GCC 4.8 appeared in r196846.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-22 08:06 PST by Konstantin Tokarev
Modified: 2016-02-22 12:04 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.41 KB, patch)
2016-02-22 08:36 PST, Konstantin Tokarev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Tokarev 2016-02-22 08:06:48 PST
This is an exact error message:

../../../Source/WebCore/html/HTMLFormElement.cpp:876:1: internal compiler error: in output_index_string, at dwarf2out.c:21825
 } // namespace
 ^
Comment 1 Konstantin Tokarev 2016-02-22 08:36:39 PST
Created attachment 271923 [details]
Patch
Comment 2 Michael Catanzaro 2016-02-22 09:07:16 PST
Comment on attachment 271923 [details]
Patch

Add a FIXME please!
Comment 3 Konstantin Tokarev 2016-02-22 09:13:56 PST
What FIXME do you mean? equalLettersIgnoringASCIICase(..., "off") where "off" is literal is used in many other places of this file, and I guess this form is a bit faster because literal needs not need is8Bit() check.
Comment 4 Chris Dumez 2016-02-22 09:33:44 PST
Comment on attachment 271923 [details]
Patch

No this is not right. It was meant to be off (without the quotes), referring to the local off variable.
Comment 5 Michael Catanzaro 2016-02-22 09:37:02 PST
(In reply to comment #4)
> No this is not right. It was meant to be off (without the quotes), referring
> to the local off variable.

Surely equalLettersIgnoringASCIICase does not have different behavior depending on whether I pass a wtf::String or a literal?
Comment 6 Chris Dumez 2016-02-22 09:37:04 PST
Comment on attachment 271923 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=271923&action=review

> Source/WebCore/ChangeLog:7
> +

The change log does not explain why this should be "off" instead of off. It seems valid to use off without quotes to me. It should end up calling:
inline bool equalIgnoringASCIICase(const AtomicString& a, const String& b);
Comment 7 Chris Dumez 2016-02-22 09:40:01 PST
(In reply to comment #6)
> Comment on attachment 271923 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=271923&action=review
> 
> > Source/WebCore/ChangeLog:7
> > +
> 
> The change log does not explain why this should be "off" instead of off. It
> seems valid to use off without quotes to me. It should end up calling:
> inline bool equalIgnoringASCIICase(const AtomicString& a, const String& b);

I don't think we do have a equalIgnoringASCIICase() overload that takes a literal. Therefore, if you pass "off" it likely calls:
inline bool equalIgnoringASCIICase(const String& a, const char* b);

Which means we don't know the length of b in advance. If we pass a String in, the size of b is known in advance.
Comment 8 Konstantin Tokarev 2016-02-22 09:44:59 PST
(In reply to comment #7)

> I don't think we do have a equalIgnoringASCIICase() overload that takes a
> literal. Therefore, if you pass "off" it likely calls:
> inline bool equalIgnoringASCIICase(const String& a, const char* b);
> 
> Which means we don't know the length of b in advance. If we pass a String
> in, the size of b is known in advance.

I believe it calls

template<unsigned length> bool equalLettersIgnoringASCIICase(const StringImpl&, const char (&lowercaseLetters)[length]);
Comment 9 Chris Dumez 2016-02-22 10:09:22 PST
(In reply to comment #8)
> (In reply to comment #7)
> 
> > I don't think we do have a equalIgnoringASCIICase() overload that takes a
> > literal. Therefore, if you pass "off" it likely calls:
> > inline bool equalIgnoringASCIICase(const String& a, const char* b);
> > 
> > Which means we don't know the length of b in advance. If we pass a String
> > in, the size of b is known in advance.
> 
> I believe it calls
> 
> template<unsigned length> bool equalLettersIgnoringASCIICase(const
> StringImpl&, const char (&lowercaseLetters)[length]);

oh, I did indeed miss the one taking a literal:
template<unsigned length> inline bool equalLettersIgnoringASCIICase(const AtomicString& string, const char (&lowercaseLetters)[length]);

That said, it does not explain why the previous code does not work in GCC. It seems perfectly legal to me.
Comment 10 Konstantin Tokarev 2016-02-22 10:28:29 PST
(In reply to comment #9)

> That said, it does not explain why the previous code does not work in GCC.
> It seems perfectly legal to me.

That's hard to explain internal compiler errors. If you are interested I'll prepare reduced test case which should reveal broken C++ construction.
Comment 11 Chris Dumez 2016-02-22 10:38:01 PST
Comment on attachment 271923 [details]
Patch

Ok to unbreak you and because equalIgnoringASCIICase() has a literal taking an override. However, I wish we understood the problem a bit better.
Comment 12 WebKit Commit Bot 2016-02-22 11:26:45 PST
Comment on attachment 271923 [details]
Patch

Clearing flags on attachment: 271923

Committed r196946: <http://trac.webkit.org/changeset/196946>
Comment 13 WebKit Commit Bot 2016-02-22 11:26:50 PST
All reviewed patches have been landed.  Closing bug.
Comment 14 Michael Catanzaro 2016-02-22 12:04:21 PST
(In reply to comment #11)
> Comment on attachment 271923 [details]
> Patch
> 
> Ok to unbreak you and because equalIgnoringASCIICase() has a literal taking
> an override. However, I wish we understood the problem a bit better.

To be clear, it's a GCC bug causing some obsolete version of GCC to crash (ICE = internal compiler error), and this modification is a workaround for that crash. It'd be reasonable to accept the patch (it's a one-liner that adds support for a new compiler) or reject it (it's a workaround for a compiler we technically don't support anymore), I'd err on the side of accept... which you did.

(In reply to comment #8)
> I believe it calls
> 
> template<unsigned length> bool equalLettersIgnoringASCIICase(const
> StringImpl&, const char (&lowercaseLetters)[length]);

Wow! This is quite esoteric C++, the only time I ever saw this syntax was in a trivia question... array parameters are normally just pointers, but for templates it's not necessarily true!