Bug 247812 - Clang 10 crashes building CPAN module SYBER/Date-5.2.0: can't implicitly cast lvalue to rvalue with this cast kind: lib/Sema/Sema.cpp:538
Summary: Clang 10 crashes building CPAN module SYBER/Date-5.2.0: can't implicitly cast...
Status: Closed DUPLICATE of bug 245530
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL: https://metacpan.org/release/SYBER/Da...
Keywords: crash
Depends on:
Blocks:
 
Reported: 2020-07-06 20:25 UTC by eserte12
Modified: 2020-07-11 09:43 UTC (History)
3 users (show)

See Also:


Attachments
Preprocessed source and associated run script (833.82 KB, application/x-xz)
2020-07-06 20:25 UTC, eserte12
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description eserte12 2020-07-06 20:25:07 UTC
Created attachment 216264 [details]
Preprocessed source and associated run script

While building the CPAN module SYBER/Date-5.2.0.tar.gz clang crashed and asked me to submit a bug report. The last lines of the build log:

...
can't implicitly cast lvalue to rvalue with this cast kind
UNREACHABLE executed at /usr/home/projects/freebsd/contrib/llvm-project/clang/lib/Sema/Sema.cpp:538!
Stack dump:
0.      Program arguments: c++ -c -Isrc -I/usr/perl5.28.0p/lib/site_perl/5.28.0/amd64-freebsd/XS/libpanda.x/i -I/usr/perl5.28.0p/lib/site_perl/5.28.0/XS/Install.x/i -I/usr/perl5.28.0p/lib/site_perl/5.28.0/amd64-freebsd/XS/Framework.x/i -I/usr/perl5.28.0p/lib/site_perl/5.28.0/amd64-freebsd/next/XS.x/i -I/usr/perl5.28.0p/lib/site_perl/5.28.0/amd64-freebsd/Export/XS.x/i -I/usr/perl5.28.0p/lib/site_perl/5.28.0/XS/libcatch.x/i -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wno-implicit-fallthrough -Wno-unused-const-variable -std=c++14 -o t/lib/MyTest_xsgen.o -pipe -pipe -O0 -DVERSION="0.0.0" -DXS_VERSION="0.0.0" -DPIC -fPIC -I/usr/perl5.28.0p/lib/5.28.0/amd64-freebsd/CORE t/lib/MyTest_xsgen.cc
1.      t/lib/MyTest.xs:303:37: current parser token ')'
2.      t/lib/MyTest_xsgen.cc:645:40: parsing function body 'XS_MyTest_posix_gmtime_bench'
3.      t/lib/MyTest_xsgen.cc:645:40: in compound statement ('{}')
4.      t/lib/MyTest_xsgen.cc:645:62: lambda expression parsing
5.      t/lib/MyTest_xsgen.cc:646:1: in compound statement ('{}')
6.      t/lib/MyTest_xsgen.cc:651:5: in compound statement ('{}')
#0 0x0000000003e3f62e (/usr/bin/c+++0x3e3f62e)
#1 0x0000000003e3d7b5 (/usr/bin/c+++0x3e3d7b5)
#2 0x0000000003e4175e (/usr/bin/c+++0x3e4175e)
#3 0x0000000003e418e1 (/usr/bin/c+++0x3e418e1)
#4 0x0000000805069ac0 (/lib/libthr.so.3+0x14ac0)
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-rc2-0-g77d76b71d7d)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
c++: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
c++: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
c++: note: diagnostic msg: /var/tmp/cpansmoker-1023/2020070619/MyTest_xsgen-7e0ba1.cpp
c++: note: diagnostic msg: /var/tmp/cpansmoker-1023/2020070619/MyTest_xsgen-7e0ba1.sh
c++: note: diagnostic msg:

********************
*** Error code 254
...

The two mentioned files are attached.
Comment 1 Dimitry Andric freebsd_committer 2020-07-07 17:14:15 UTC
This turns out to be the same issue as bug 245530. I reported it upstream as https://bugs.llvm.org/show_bug.cgi?id=45521, but there was no feedback yet.
Comment 2 commit-hook freebsd_committer 2020-07-08 16:51:02 UTC
A commit references this bug:

Author: dim
Date: Wed Jul  8 16:50:48 UTC 2020
New revision: 363013
URL: https://svnweb.freebsd.org/changeset/base/363013

Log:
  Merge commit 065fc1eafe7c from llvm git (by Richard Smith):

    PR45521: Preserve the value kind when performing a standard
    conversion sequence on a glvalue expression.

    If the sequence is supposed to perform an lvalue-to-rvalue
    conversion, then one will be specified as the first conversion in the
    sequence. Otherwise, one should not be invented.

  This should fix clang crashing with "can't implicitly cast lvalue to
  rvalue with this cast kind", followed by "UNREACHABLE executed at
  /usr/src/contrib/llvm-project/clang/lib/Sema/Sema.cpp:538!", when
  building recent versions of Ceph, and the CPAN module SYBER/Date-5.2.0.

  Reported by:	Willem Jan Withagen <wjw@digiware.nl>, eserte12@yahoo.de
  PR:		245530, 247812
  MFC after:	3 days

Changes:
  head/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
  head/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2020-07-10 10:05:25 UTC
^Triage: Close as dupe of bug 245530, tracking merges in that issue

*** This bug has been marked as a duplicate of bug 245530 ***
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2020-07-10 10:05:46 UTC
^Triage: Assign to committer resolving
Comment 5 commit-hook freebsd_committer 2020-07-11 09:43:43 UTC
A commit references this bug:

Author: dim
Date: Sat Jul 11 09:43:18 UTC 2020
New revision: 363092
URL: https://svnweb.freebsd.org/changeset/base/363092

Log:
  MFC r363013:

  Merge commit 065fc1eafe7c from llvm git (by Richard Smith):

    PR45521: Preserve the value kind when performing a standard
    conversion sequence on a glvalue expression.

    If the sequence is supposed to perform an lvalue-to-rvalue
    conversion, then one will be specified as the first conversion in the
    sequence. Otherwise, one should not be invented.

  This should fix clang crashing with "can't implicitly cast lvalue to
  rvalue with this cast kind", followed by "UNREACHABLE executed at
  /usr/src/contrib/llvm-project/clang/lib/Sema/Sema.cpp:538!", when
  building recent versions of Ceph, and the CPAN module SYBER/Date-5.2.0.

  Reported by:	Willem Jan Withagen <wjw@digiware.nl>, eserte12@yahoo.de
  PR:		245530, 247812

Changes:
_U  stable/11/
_U  stable/11/contrib/llvm-project/clang/
  stable/11/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
  stable/11/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp
_U  stable/12/
  stable/12/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
  stable/12/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp