InternalScopedString g1_loc(256), g2_loc(256);
PrintGlobalLocation(&g1_loc, *g1);
PrintGlobalLocation(&g2_loc, *g2);
- Printf(" [1] size=%zd %s %s\n", g1->size, g1->name, g1_loc.data());
- Printf(" [2] size=%zd %s %s\n", g2->size, g2->name, g2_loc.data());
+ Printf(" [1] size=%zd '%s' %s\n", g1->size,
+ MaybeDemangleGlobalName(g1->name), g1_loc.data());
+ Printf(" [2] size=%zd '%s' %s\n", g2->size,
+ MaybeDemangleGlobalName(g2->name), g2_loc.data());
if (stack_id1 && stack_id2) {
Printf("These globals were registered at these points:\n");
Printf(" [1]:\n");
}
Report("HINT: if you don't care about these warnings you may set "
"ASAN_OPTIONS=detect_odr_violation=0\n");
- ReportErrorSummary("odr-violation", g1_loc.data(), 0, g1->name);
+ InternalScopedString error_msg(256);
+ error_msg.append("odr-violation: global '%s' at %s",
+ MaybeDemangleGlobalName(g1->name), g1_loc.data());
+ ReportErrorSummary(error_msg.data());
}
// ----------------------- CheckForInvalidPointerPair ----------- {{{1
#endif
#if BUILD_SO
-char G[SZ];
+namespace foo { char G[SZ]; }
#else
#include <stdio.h>
-char G[100];
+namespace foo { char G[100]; }
+// CHECK: ERROR: AddressSanitizer: odr-violation
+// CHECK: size=100 'foo::G' {{.*}}odr-violation.cc:[[@LINE-2]]:22
+// CHECK: size={{4|100}} 'foo::G'
int main(int argc, char **argv) {
- printf("PASS: %p\n", &G);
+ printf("PASS: %p\n", &foo::G);
}
#endif
-// CHECK: ERROR: AddressSanitizer: odr-violation
-// CHECK: size=100 G
-// CHECK: size={{4|100}} G
// CHECK: These globals were registered at these points:
// CHECK: ODR-EXE
// CHECK: ODR-SO
+// CHECK: SUMMARY: AddressSanitizer: odr-violation: global 'foo::G' at {{.*}}odr-violation.cc
// DISABLED: PASS