[llvm-bugs] [Bug 52579] New: Exceptions don't work when used with -fvisibility=hidden

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 22 07:24:31 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=52579

            Bug ID: 52579
           Summary: Exceptions don't work when used with
                    -fvisibility=hidden
           Product: libc++
           Version: 13.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: schopf.dan at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Created attachment 25466
  --> https://bugs.llvm.org/attachment.cgi?id=25466&action=edit
exception source file

Using exceptions in shared libraries compiled with -fvisibility=hidden yields
the wrong results

Steps to Reproduce: 

  1. Compile the attached files with the following commands:

    clang++ -shared -stdlib=libc++ -fvisibility=hidden exception.cpp -o
libexception.so
    clang++ -stdlib=libc++ test.cpp libexception.so -o exception_test

  2. Run the exception_test binary

Actual Results: 

  The output is "Error value = -2"

Expected Results: 

  The output should be "Error value = 1"


This error cannot be reproduced when either removing the -fvisibility=hidden
switch or
when using -stdlib=libstdc++. So using -stdlib=libstdc++ together with
-fvisibility=hidden
produces the correct output.

Reproduced with clang-13 on Arch Linux.

-- 
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/20211122/5a858924/attachment.html>


More information about the llvm-bugs mailing list