[Bug libfortran/67534] New: libgfortran.h sanitizer complains on left shift of ~0 runtime error: left shift of negative value -1
zeccav at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 10 03:34:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67534
Bug ID: 67534
Summary: libgfortran.h sanitizer complains on left shift of ~0
runtime error: left shift of negative value -1
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: zeccav at gmail dot com
Target Milestone: ---
The sanitizer complains on libgfortran.h:408
((~((index_type) 0) >> GFC_DTYPE_SIZE_SHIFT) << GFC_DTYPE_SIZE_SHIFT)
issuing
runtime error: left shift of negative value -1
because 0 is int. I believe it must be 0u to avoid undefined behaviour as in
((~((index_type) 0u) >> GFC_DTYPE_SIZE_SHIFT) << GFC_DTYPE_SIZE_SHIFT)
Target: x86_64-unknown-linux-gnu
More information about the Gcc-bugs
mailing list