[llvm-bugs] [Bug 27443] New: [CWG 734] Nonconforming aliasing of block scope objects
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 20 19:08:22 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27443
Bug ID: 27443
Summary: [CWG 734] Nonconforming aliasing of block scope
objects
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: frankhb1989 at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
Case:
// clang++ -std=c++14 -O0 -pedantic-errors
#include <cstdlib>
void foo(const int* p = {})
{
const int a[] = {1, 2, 3, 4};
if(p == a)
std::abort();
if(!p)
foo(a);
}
int main()
{
foo();
}
As per [intro.object]/5, 'std::abort' should not be called. The rule is
introduced by resolution of CWG 734 and applicable here, though the title of
that issue is about "namespace-scope variables".
However, The program compiled by clang++ with will abort while g++ works well.
The C compilers have similar issues. Not sure for the requirements from ISO C.
Related discussion: https://gcc.gnu.org/ml/gcc/2016-04/msg00178.html
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160421/48096c90/attachment.html>
More information about the llvm-bugs
mailing list