public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104770] New: std::any_cast cause SIGBUS instead of throwing std::bad_any_cast
@ 2022-03-03 12:01 payload.prom0j at icloud dot com
  2022-03-03 12:08 ` [Bug target/104770] " pinskia at gcc dot gnu.org
  2022-03-03 12:52 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: payload.prom0j at icloud dot com @ 2022-03-03 12:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104770

            Bug ID: 104770
           Summary: std::any_cast cause SIGBUS instead of throwing
                    std::bad_any_cast
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: payload.prom0j at icloud dot com
  Target Milestone: ---

Created attachment 52555
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52555&action=edit
test code

std::any a1="123.456";

    try
    {
      std::cout<<"  std::any_cast<double>(a1) =
"<<std::any_cast<double>(a1)<<std::endl;
    }
    catch(std::exception const &e)
    {
      std::cout<<"  std::any_cast<double>(a1) generate exception:
"<<e.what()<<std::endl;
    }


std::any_cast a char* to double should raise a std::bad_any_cast exception but
a SIGBUS is generated.




gcc details:
victor@Turing test_gcc_any_cast % g++-11 -v
Using built-in specs.
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/11.2.0_3/libexec/gcc/aarch64-apple-darwin21/11/lto-wrapper
Target: aarch64-apple-darwin21
Configured with: ../configure --prefix=/opt/homebrew/Cellar/gcc/11.2.0_3
--libdir=/opt/homebrew/Cellar/gcc/11.2.0_3/lib/gcc/11 --disable-nls
--enable-checking=release --with-gcc-major-version-only
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-11
--with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr
--with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl
--with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 11.2.0_3'
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--build=aarch64-apple-darwin21 --with-system-zlib --disable-multilib
--with-native-system-header-dir=/usr/include
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.2.0_3)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/104770] std::any_cast cause SIGBUS instead of throwing std::bad_any_cast
  2022-03-03 12:01 [Bug c++/104770] New: std::any_cast cause SIGBUS instead of throwing std::bad_any_cast payload.prom0j at icloud dot com
@ 2022-03-03 12:08 ` pinskia at gcc dot gnu.org
  2022-03-03 12:52 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-03-03 12:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104770

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |target
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |MOVED
             Target|                            |aarch64-apple-darwin21
           Keywords|                            |EH, wrong-code

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Please file it with homebrew as aarch64 darwin support is not upstreamed yet:
https://github.com/Homebrew/homebrew-core/issues

Plus it works on x86_64-linux-gnu and others just fine.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/104770] std::any_cast cause SIGBUS instead of throwing std::bad_any_cast
  2022-03-03 12:01 [Bug c++/104770] New: std::any_cast cause SIGBUS instead of throwing std::bad_any_cast payload.prom0j at icloud dot com
  2022-03-03 12:08 ` [Bug target/104770] " pinskia at gcc dot gnu.org
@ 2022-03-03 12:52 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-03 12:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104770

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Victor Tsang from comment #0)
> --with-bugurl=https://github.com/Homebrew/homebrew-core/issues

As it says there ^^

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-03 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 12:01 [Bug c++/104770] New: std::any_cast cause SIGBUS instead of throwing std::bad_any_cast payload.prom0j at icloud dot com
2022-03-03 12:08 ` [Bug target/104770] " pinskia at gcc dot gnu.org
2022-03-03 12:52 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).