Bug 24099 - ARM Compiler Warnings in pcre_exec.cpp
Summary: ARM Compiler Warnings in pcre_exec.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-23 11:35 PST by Carol Szabo
Modified: 2009-02-26 13:46 PST (History)
4 users (show)

See Also:


Attachments
Proposed fix. (1.70 KB, patch)
2009-02-23 11:45 PST, Carol Szabo
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carol Szabo 2009-02-23 11:35:00 PST
When compiling pcre_exec.cpp the ARM Compiler issues the following warnings:
"../JavaScriptCore/pcre/pcre_exec.cpp", line 1823: Warning:  #546-D: transfer of control bypasses initialization of:
            variable "othercase" (declared at line 1189)
          case 28: goto RRETURN_28;
                   ^
"../JavaScriptCore/pcre/pcre_exec.cpp", line 1824: Warning:  #546-D: transfer of control bypasses initialization of:
            variable "othercase" (declared at line 1189)
          case 29: goto RRETURN_29;
This is due to the fact that the variable "othercase" declared, defined and initialized in line 1189 goes out of scope 
and back in scope for non GCC compilers, that is when USE_COMPUTED_GOTO_FOR_MATCH_RECURSION is not defined.
In this case execution branches out from line 1203 during expansion of the RECURSIVE_MATCH MACRO to line 1823 where othercase is
out of scope un then execution is resumed at line 1204 when the variable is in scope but not initialized.
Most recent compilers do not pick this up as an error (like GCC does when used with relevant flags), but the practice of by-passing
declaration of local variables via goto or case statements is not very portable and is confusing. 
These warnings and potential gcc errors can be easily eliminated by moving the declaration of 
"othercase" to function scope, which has no adverse effects.
Patch will follow.
Comment 1 Carol Szabo 2009-02-23 11:45:50 PST
Created attachment 27886 [details]
Proposed fix.
Comment 2 Darin Adler 2009-02-24 13:32:08 PST
Comment on attachment 27886 [details]
Proposed fix.

Seems OK. r=me
Comment 3 Holger Freyther 2009-02-26 09:12:21 PST
Landed in r41252.