Ich versuche, eine Quelldatei auf PPC64-LE zu kompilieren. Ich benutze den xlC-Compiler und die Kompilierung schlägt fehl. GCC akzeptiert das Programm, daher bin ich nicht wirklich sicher, was die Ursache der Probleme sind.xlC und Operation zwischen den Typen "Vektor unsigned int" und "int" ist nicht zulässig
Hier ist die Befehlszeile ein:
$ xlc test-p8.c -qarch=pwr8 -qaltivec -o test-p8.exe
Hier ist der Compiler-Fehler:
"test-p8.c", line 113.52: 1506-324 (S) "int" cannot be converted to "vector unsigned int".
"test-p8.c", line 120.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 121.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 122.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 123.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 124.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 125.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 126.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 127.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 128.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
"test-p8.c", line 130.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed.
Hier ist der relevante Teil der Quelldatei. Die Quelldatei ist ein reduzierter Fall für another problem, und es ist available on GitHub.
$ cat -n test-p8.c
...
12 typedef unsigned char uint8_t;
13 typedef unsigned long long uint64_t;
14 typedef vector unsigned char uint8x16_p8;
15 typedef vector unsigned int uint64x2_p8;
...
76 __attribute__((aligned(16)))
77 uint8_t ks[176] = {
78 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x9, 0xcf, 0x4f, 0x3c,
...
89 };
...
113 uint64x2_p8 block = (uint64x2_p8)vec_vsx_ld(0U, (const uint8_t*)plain);
...
118 block = vec_xor(block, (uint64x2_p8)vec_ld(0U, (const uint8_t*)ks));
...
120 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(16U, (const uint8_t*)ks));
121 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(32U, (const uint8_t*)ks));
122 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(48U, (const uint8_t*)ks));
123 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(64U, (const uint8_t*)ks));
124 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(80U, (const uint8_t*)ks));
125 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(96U, (const uint8_t*)ks));
126 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(112U, (const uint8_t*)ks));
127 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(128U, (const uint8_t*)ks));
128 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(144U, (const uint8_t*)ks));
129
130 block = __builtin_crypto_vcipherlast(block, (uint64x2_p8)vec_ld(160U, (const uint8_t*)ks));
__builtin_crypto_vcipher
ist ein GCC eingebaut, und IBM erklärt xlC supports it.
Zeile 118 ist wie alle anderen Zeilen oben abgebildet, löst aber keine Warnung oder Fehler aus.
Was ist das Problem, und wie kann ich es beheben?
Danke. * "Das Redbook, mit dem du verlinkt hast, ist ... [nicht eingebaut]" * - es klingt, als hätte ich die URL des falschen Browser-Tabs kopiert/eingefügt. Ich hätte das Compilerhandbuch oder die Online-Dokumentation verwenden sollen. Ich erinnere mich nicht mehr an welches. – jww
Bitte lassen Sie uns wissen, wenn Sie einen Ort bemerken, an dem unsere Dokumente geändert werden müssen. [Hier ist ein Link] (https://www.ibm.com/support/knowledgecenter/en/SSXVZZ_13.1.5/com.ibm.xlcpp1315.lelinux.doc/compiler_ref/bif_crypto_aes_vcipher.html) zu diesem Thema in unserer Online-Dokumentation. – trudeaun
Danke nochmal. In diesem Fall denke ich, dass die Compiler-Diagnose verbessert werden sollte. Der Compiler hätte "__builtin_crypto_vcipher" explizit als eine Funktion ohne einen Prototyp oder eine nicht deklarierte Funktion identifiziert. Wenn ich sage, dass "int" nicht in "Vektor" umgewandelt werden kann, ist das nicht sehr hilfreich. – jww