Bug 220714 - [AppleWin 32bit][LLInt] LLIntData.h(104) : warning C4172: returning address of local variable or temporary: id
Summary: [AppleWin 32bit][LLInt] LLIntData.h(104) : warning C4172: returning address o...
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
Keywords: InRadar
Depends on:
Reported: 2021-01-18 13:30 PST by Fujii Hironori
Modified: 2021-02-03 10:41 PST (History)
9 users (show)

See Also:

WIP patch (1.09 KB, patch)
2021-01-18 13:33 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (7.75 KB, patch)
2021-02-02 15:25 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2021-01-18 13:30:12 PST
LowLevelInterpreterLib.dir\llint\LowLevelInterpreter.cpp.obj /FdSource\JavaScriptCore\CMakeFiles\LowLevelInterpreterLib.dir\ /FS -c ..\..\Source\JavaScriptCore\llint\LowLevelInterpreter.cpp
C:\home\webkit\gb\Source\JavaScriptCore\llint\LLIntData.h(104) : error C2220: the following warning is treated as an error
C:\home\webkit\gb\Source\JavaScriptCore\llint\LLIntData.h(104) : warning C4172: returning address of local variable or temporary: id
Comment 1 Fujii Hironori 2021-01-18 13:33:36 PST
Created attachment 417845 [details]
WIP patch
Comment 2 Radar WebKit Bug Importer 2021-01-25 13:31:14 PST
Comment 3 Mark Lam 2021-01-26 12:47:37 PST
Comment on attachment 417845 [details]
WIP patch

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

> Source/JavaScriptCore/llint/LLIntData.h:109
>  inline const Opcode& getOpcode(OpcodeID id)
>  {
>      return g_opcodeMap[id];
> +}
>  #else
> -    return static_cast<Opcode>(id);
> -#endif
> +inline const Opcode getOpcode(OpcodeID id)

I think it's a bad pattern to have the same function return 2 different return types.  This made me wonder who is relying on the address of Opcode as a return value, and it looks like it's only the JIT functions (please double check this to confirm).  Can you try making getOpcode() consistently returning Opcode, and add a new getOpcodeAddress() function guarded by #if ENABLE(JIT) that returns Opcode* and update the relevant clients to use it instead?  See if that works better.
Comment 4 Yusuke Suzuki 2021-02-02 15:25:14 PST
Created attachment 419073 [details]
Comment 5 Mark Lam 2021-02-02 15:32:18 PST
Comment on attachment 419073 [details]

Comment 6 EWS 2021-02-03 10:41:01 PST
Committed r272330: <https://trac.webkit.org/changeset/272330>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419073 [details].