Skip to content

AllocaInst::getAllocationSize/AllocaInst::getAllocationSizeInBits should check for overflow #91380

Closed
@efriedma-quic

Description

@efriedma-quic

Currently, the code just blindly multiplies the size, and can therefore return a nonsense result. (The behavior isn't really defined in the overflow case, but reasoning based on the overflowed computation is likely to lead to weird results.)

// Try to determine the size of the allocation.
has code to compute the allocation size while conservatively checking for overflow; we should use similar logic, then make the inliner call getAllocationSize(). Maybe use the multiply-with-overflow helper from CheckedArithmetic.h instead of writing out that code.

Metadata

Metadata

Assignees

Labels

good first issuehttps://github.com/llvm/llvm-project/contributellvm:ir

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions