LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 48075 - opt -memcpyopt crashing with Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Summary: opt -memcpyopt crashing with Assertion `isa<X>(Val) && "cast<Ty>() argument o...
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Scalar Optimizations (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-04 07:09 PST by Mikael Holmén
Modified: 2020-11-23 06:18 PST (History)
2 users (show)

See Also:
Fixed By Commit(s): c5a4d80fd47c


Attachments
bbi-48944.ll reproducer (414 bytes, text/plain)
2020-11-04 07:09 PST, Mikael Holmén
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Holmén 2020-11-04 07:09:39 PST
Created attachment 24135 [details]
bbi-48944.ll reproducer

Reproduce with:
 opt -S -o - bbi-48944.ll -memcpyopt

Result:
 opt: ../include/llvm/Support/Casting.h:269: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::PointerType, Y = llvm::Type]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

This seems to be rather old, I've reproduced it with saved builds from July 2019.
Comment 1 Sanjay Patel 2020-11-22 10:32:34 PST
I'm not sure if there's some enhancement potential in here, but this should prevent the crashing at least by dyn_casting instead of plain casting:
https://reviews.llvm.org/rGc5a4d80fd47c
Comment 2 Mikael Holmén 2020-11-23 06:18:04 PST
Thanks!