/* Clear first two bits. */
else
{
- if (buf[0] == '4' || buf[0] == '6')
+ if (buf[0] == '2' || buf[0] == '4' || buf[0] == '6')
buf[0] = '0';
- else if (buf[0] == '5' || buf[0] == '7')
+ else if (buf[0] == '3' || buf[0] == '5' || buf[0] == '7')
buf[0] = '1';
}
}
/* Clear first two bits. */
else
{
- if (buf[0] == '4' || buf[0] == '6')
+ if (buf[0] == '2' || buf[0] == '4' || buf[0] == '6')
buf[0] = '0';
- else if (buf[0] == '5' || buf[0] == '7')
+ else if (buf[0] == '3' || buf[0] == '5' || buf[0] == '7')
buf[0] = '1';
}
}
--- /dev/null
+! PR fortran/96859
+! { dg-do run }
+
+program pr96859
+ if (merge_bits(32767_2, o'1234567', 32767_2).ne.32767_2) stop 1
+ if (merge_bits(o'1234567', 32767_2, o'1234567').ne.32767_2) stop 2
+ if (merge_bits(32767_2, o'1234567', b'010101').ne.14711_2) stop 3
+ if (merge_bits(32767_2, o'1234567', z'12345678').ne.32639_2) stop 4
+ if (int (o'1034567', 2).ne.14711_2) stop 5
+ if (int (o'1234567', 2).ne.14711_2) stop 6
+ if (int (o'1434567', 2).ne.14711_2) stop 7
+ if (int (o'1634567', 2).ne.14711_2) stop 8
+ if (int (o'1134567', 2).ne.-18057_2) stop 9
+ if (int (o'1334567', 2).ne.-18057_2) stop 10
+ if (int (o'1534567', 2).ne.-18057_2) stop 11
+ if (int (o'1734567', 2).ne.-18057_2) stop 12
+ if (int (o'70123456776543211234567', 8).ne.1505855851274254711_8) stop 13
+ if (int (o'72123456776543211234567', 8).ne.1505855851274254711_8) stop 14
+ if (int (o'74123456776543211234567', 8).ne.1505855851274254711_8) stop 15
+ if (int (o'76123456776543211234567', 8).ne.1505855851274254711_8) stop 16
+ if (int (o'71123456776543211234567', 8).ne.-7717516185580521097_8) stop 17
+ if (int (o'73123456776543211234567', 8).ne.-7717516185580521097_8) stop 18
+ if (int (o'75123456776543211234567', 8).ne.-7717516185580521097_8) stop 19
+ if (int (o'77123456776543211234567', 8).ne.-7717516185580521097_8) stop 20
+end