[LLVMbugs] [Bug 15574] New: incorrect compilation with -Os

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 22 15:55:02 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15574

            Bug ID: 15574
           Summary: incorrect compilation with -Os
           Product: new-bugs
           Version: 3.2
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: drefleladi at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10230
  --> http://llvm.org/bugs/attachment.cgi?id=10230&action=edit
output of clang -E min-example.cpp

Dear clang devs,

I hope this is the right place to post a bug report.
You'll find below a simple reproductible example for an incorrect compilation
bug that shows up using -Os on clang 3.2-1 (from the latest ubuntu beta).
Boost is coming from libboost-dev 1.49.0.1 (also from the latest ubuntu beta)

Also, the output of "clang -E min-example.cpp" is attached to the bug report.

Thank you for making such a great product.

Yours Sincerely,
Gurg Hackpof

---------------------------

fred at virtualbuntu:~$ clang++ -std=c++11 -O min-example.cpp -o working
fred at virtualbuntu:~$ ./working
fred at virtualbuntu:~$ clang++ -std=c++11 -Os min-example.cpp -o buggy
fred at virtualbuntu:~$ ./buggy
terminate called after throwing an instance of 'int'
Aborted (core dumped)


fred at virtualbuntu:~$ clang++ -v
Ubuntu clang version 3.2-1~exp5ubuntu2 (tags/RELEASE_32/final) (based on LLVM
3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix


fred at virtualbuntu:~$ cat min-example.cpp
#include <boost/optional.hpp>

struct Parent {
        int one;
        Parent() : one(1){}
        void throwParent(const boost::optional<int>& arg) {
                if (one == 1) {
                        throw 666;
                } else {
                        notUsed(arg);
                }
        }
        virtual void notUsed( const boost::optional<int>& arg) = 0;
};

struct Child : public Parent {
        virtual void notUsed( const boost::optional<int>& arg) override {
        }
        void throwChild() {
                throwParent(boost::none);
        }
};

int main(){
        try {
                Child().throwChild();
        } catch( int ) {
                return 0;
        }
}

-- 
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/20130322/8af67b32/attachment.html>


More information about the llvm-bugs mailing list