Test_tree and copynode test failures on clang 10+
Description of problem:
Test_tree and copynode tests fail when compiling with recent clang versions using -O2 or higher optimization levels (on -O1 tests succeed)
Version of libtasn1 used:
4.16.0
Distributor of libtasn1 (e.g., Ubuntu, Fedora, RHEL)
n/a, compiling it myself on Exherbo
How reproducible:
Compile libtasn1 with clang 10 or newer with -O2 optimization or higher. I used clang 11, but I found a debian log for clang 10 in Google's webcache https://webcache.googleusercontent.com/search?q=cache:zRcDmB5LK6QJ:https://clang.debian.net/logs/2020-05-01-10/libtasn1-6_4.16.0-2_unstable_clang10.log&hl=en
Actual results:
FAIL: Test_tree
===============
./Test_tree.asn:121: Warning: VisibleString is a built-in ASN.1 type.
./Test_tree.asn:123: Warning: NumericString is a built-in ASN.1 type.
./Test_tree.asn:125: Warning: IA5String is a built-in ASN.1 type.
./Test_tree.asn:127: Warning: TeletexString is a built-in ASN.1 type.
./Test_tree.asn:129: Warning: PrintableString is a built-in ASN.1 type.
./Test_tree.asn:131: Warning: UniversalString is a built-in ASN.1 type.
./Test_tree.asn:134: Warning: BMPString is a built-in ASN.1 type.
./Test_tree.asn:138: Warning: UTF8String is a built-in ASN.1 type.
Error at line 707
ERROR in 254:
Action 18 -
Error expected: MEM_ERROR - 79
Error detected: VALUE_NOT_VALID - 0
FAIL Test_tree (exit status: 1)
FAIL: copynode
==============
./pkix.asn:332: Warning: VisibleString is a built-in ASN.1 type.
./pkix.asn:334: Warning: NumericString is a built-in ASN.1 type.
./pkix.asn:336: Warning: IA5String is a built-in ASN.1 type.
./pkix.asn:338: Warning: TeletexString is a built-in ASN.1 type.
./pkix.asn:340: Warning: PrintableString is a built-in ASN.1 type.
./pkix.asn:342: Warning: UniversalString is a built-in ASN.1 type.
./pkix.asn:345: Warning: BMPString is a built-in ASN.1 type.
./pkix.asn:349: Warning: UTF8String is a built-in ASN.1 type.
LIBTASN1 ERROR: VALUE_NOT_VALID
Cannot copy node
FAIL copynode (exit status: 1)
Expected results:
Tests succeed
Edited by Paul Mulders