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: unassignedclangb...@nondot.org
          Reporter: frankhb1...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to