brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 7a386e0 Raw
54 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Fortran syntax considers signed int literals in complex literals3! to be a distinct production, not an application of unary +/- to4! an unsigned int literal, so they're used here to test overflow5! on signed int literal constants.  The literals are tested here6! as part of expressions that name resolution must analyze.7 8complex, parameter :: okj1 = 127_1, okz1 = (+127_1, -128_1)9!ERROR: Integer literal is too large for INTEGER(KIND=1)10complex, parameter :: badj1 = 128_111!ERROR: Integer literal is too large for INTEGER(KIND=1)12complex, parameter :: badz1 = (+128_1, 0)13complex, parameter :: okj1a = 128_214complex, parameter :: okz1a = (+128_2, 0)15 16complex, parameter :: okj2 = 32767_2, okz2 = (+32767_2, -32768_2)17!ERROR: Integer literal is too large for INTEGER(KIND=2)18complex, parameter :: badj2 = 32768_219!ERROR: Integer literal is too large for INTEGER(KIND=2)20complex, parameter :: badz2 = (+32768_2, 0)21complex, parameter :: okj2a = 32768_422complex, parameter :: okz2a = (+32768_4, 0)23 24complex, parameter :: okj4 = 2147483647_4, okz4 = (+2147483647_4, -2147483648_4)25!ERROR: Integer literal is too large for INTEGER(KIND=4)26complex, parameter :: badj4 = 2147483648_427!ERROR: Integer literal is too large for INTEGER(KIND=4)28complex, parameter :: badz4 = (+2147483648_4, 0)29complex, parameter :: okj4a = 2147483648_830complex, parameter :: okz4a = (+2147483648_8, 0)31 32complex, parameter :: okj4d = 2147483647, okz4d = (+2147483647, -2147483648)33!WARNING: Integer literal is too large for default INTEGER(KIND=4); assuming INTEGER(KIND=8) [-Wbig-int-literals]34complex, parameter :: badj4dext = 214748364835!WARNING: Integer literal is too large for default INTEGER(KIND=4); assuming INTEGER(KIND=8) [-Wbig-int-literals]36complex, parameter :: badz4dext = (+2147483648, 0)37 38complex, parameter :: okj8 = 9223372036854775807_8, okz8 = (+9223372036854775807_8, -9223372036854775808_8)39!ERROR: Integer literal is too large for INTEGER(KIND=8)40complex, parameter :: badj8 = 9223372036854775808_841!ERROR: Integer literal is too large for INTEGER(KIND=8)42complex, parameter :: badz8 = (+9223372036854775808_8, 0)43complex, parameter :: okj8a = 9223372036854775808_1644complex, parameter :: okz8a = (+9223372036854775808_16, 0)45 46complex, parameter :: okj16 = 170141183460469231731687303715884105727_1647complex, parameter :: okz16 = (+170141183460469231731687303715884105727_16, -170141183460469231731687303715884105728_16)48!ERROR: Integer literal is too large for INTEGER(KIND=16)49complex, parameter :: badj16 = 170141183460469231731687303715884105728_1650!ERROR: Integer literal is too large for INTEGER(KIND=16)51complex, parameter :: badz16 = (+170141183460469231731687303715884105728_16, 0)52 53end54