[Webkit-unassigned] [Bug 247121] New: StringOperations.cpp test re-defines WTF::StringTypeAdapter implementation, undefined behaviour
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Oct 27 05:34:20 PDT 2022
https://bugs.webkit.org/show_bug.cgi?id=247121
Bug ID: 247121
Summary: StringOperations.cpp test re-defines
WTF::StringTypeAdapter implementation, undefined
behaviour
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Web Template Framework
Assignee: webkit-unassigned at lists.webkit.org
Reporter: kkinnunen at apple.com
StringOperations.cpp test re-defines WTF::StringTypeAdapter implementation, undefined behaviour
StringOperations.cpp re-defines the template implementations in order to count the String copies.
This is undefined behaviour. Two different compilation units linked to same binary cannot have two different implementations for the same name symbol.
The linker knows of two different implementations by the same name, and may do whatever.
Consider:
// header.h
inline int myFunc()
{
WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING();
return 1;
}
// impl1.cpp:
#define WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING() (void())
#include "header.h"
void call1() {
myFunc();
}
// impl2.cpp:
#define WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING() printf("kimmo")
#include "header.h"
void call2() {
myFunc();
}
// main.cpp
void call1();
void call2();
int main() {
call1();
call2();
return 0;
}
c++ impl1.cpp impl2.cpp main.cpp -o my-undefined
It's unclear what the app does.
Currently, all invocations of TestWTF seem to use the test-overridden hack of the implementation.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221027/cf0cb86b/attachment.htm>
More information about the webkit-unassigned
mailing list