This is an archive of the discontinued LLVM Phabricator instance.

In C++11 it is undefined to shift into the sign bit
AbandonedPublic

Authored by filcab on Mar 31 2016, 10:14 AM.

Details

Reviewers
samsonov
rsmith
Summary

Clang was using C++14 rules for shifts into the sign bit with any C++
standard. Now it has the C++ <14 special case (same as C).

Using this C++11 standard draft as reference (before CWG 1457):
https://github.com/cplusplus/draft/blob/672675e01528fba6ca02f5340eee747566ebdca8/papers/N3376.pdf

Diff Detail

Event Timeline

filcab updated this revision to Diff 52233.Mar 31 2016, 10:14 AM
filcab retitled this revision from to In C++11 it is undefined to shift into the sign bit.
filcab updated this object.
filcab added reviewers: rsmith, samsonov.
filcab added a subscriber: cfe-commits.
rsmith requested changes to this revision.Mar 31 2016, 10:59 AM
rsmith edited edge metadata.

Core issue 1457 is a DR against C++11, so it applies to our C++11 mode.

This revision now requires changes to proceed.Mar 31 2016, 10:59 AM
filcab added a subscriber: filcab.Mar 31 2016, 11:10 AM

That means that our C++11 mode will have some fixes, right?
How can we call what out C++11 mode is? Are there updated versions of
the standard? Are there lists of defects that we have fixed and others
we haven't?

Sorry, I'm not too familiar with how the standard+fixes usually work.

Thank you,

Filipe

That means that our C++11 mode will have some fixes, right?

Right. The standard's rules are often incoherent or unimplementable without the fixes in DRs, so it's not meaningful to implement ISO C++ as standardized. In order to avoid making judgement calls ourselves, we (and many other compiler vendors) enable *all* relevant DR fixes for each language mode.

How can we call what out C++11 mode is?

It's ISO C++11, plus all relevant defect reports. (Incidentally, this is why C++98 and C++03 modes are identical across typical compilers -- the difference is only DRs.)

Are there updated versions of the standard?

No. (As the C++ standard editor, I've been considering maintaining such an alternative standard, but it's a large amount of work, and it would give the false impression that the document containing the standard + DRs is in some way an official product of the ISO C++ committee.)

Are there lists of defects that we have fixed and others we haven't?

clang.llvm.org/cxx_dr_status.html is has a complete list of core issues, along with an incomplete list of Clang's implementation status for them. If you want to get involved with that, there are tests in clang's test/CXX/drs/... for each such issue, containing special comments describing our implementation status (the HTML status page is then generated by scraping those comments); tests for more DRs would be appreciated!

filcab abandoned this revision.Mar 31 2016, 11:57 AM

Thanks for clarifying, Richard.
I'll think about getting some fixes/tests in for our DRs.