A fix is available
APAR status
Closed as program error.
Error description
When using the memcmp() function in the following testcase: 1 #include <metal.h> 2 #include <string.h> 3 #include <stdio.h> 4 5 int compare(const void * num1, const void * num2) { 6 int val= memcmp(&num1, &num2, sizeof(num1)); 7 return val; 8 } Compiling for Metal C and generating assembler source: >xlc -S -qmetal -qlist -qsource -Wc,"NOSEARCH,SEARCH(/usr/include/metal)" test.c >test.lst >as -a=test.asmlst test.s If using references "&" to the address in the pointer, comparing &num1 and &num1, the following assembler gets generated for memcmp() function: 99 36 * int val= memcmp(&num1, &num2, sizeof(num1)); 000006 100 0000004A 58E0 D070 00000070 37 L 14,112(,13) #SR_PARM_1 000006 101 0000004E E54C D054 0000 00000054 38 MVHI 84(13),0 000006 102 R:E 00000000 39 USING @@PARMD@1,14 000006 103 00000054 41F0 E004 00000004 40 LA 15,@3num2 000006 104 41 DROP 14 000006 105 R:F 00000000 42 USING @@PARMD@1,15 000006 106 00000058 D503 F000 F000 00000000 00000000 43 CLC @2num1,@3num2-4 000006 The CLC seems to compare the same R15 and not R14 with R15: 106 00000058 D503 F000 F000 00000000 00000000 43 CLC @2num1,@3num2-4 000006
Local fix
If you use a pointer value in the memcmp() function it should generate the CLC correctly to compare R14 and R15: 6 int val= memcmp(num1, num2, sizeof(num1)); >xlc -S -qmetal -qlist -qsource -Wc,"NOSEARCH,SEARCH(/usr/include/metal)" test.c >test.lst >as -a=test.asmlst test.s 105 0000005C D503 E000 F000 00000000 00000000 42 CLC 0(4,14),0(15) 000006
Problem summary
**************************************************************** * USERS AFFECTED: Users of metal C with generated SS or SSE * * instruction format instruction, where both * * address operands are directly from the * * parameters save area. * **************************************************************** * PROBLEM DESCRIPTION: Incorrect assembly code might be * * generated for metal C program with * * generated SS or SSE instruction format * * instruction, where both address * * operands are directly from the * * parameters save area. * **************************************************************** * RECOMMENDATION: install the PTF * **************************************************************** N/A
Problem conclusion
install the PTF
Temporary fix
Comments
APAR Information
APAR number
PH66223
Reported component name
C/C++ FOR MVS
Reported component ID
56551210A
Reported release
7C0
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2025-04-21
Closed date
2025-06-10
Last modified date
2025-08-02
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
UO03571
Modules/Macros
CCNECICS CCNECWI CCNED240 CCNEDSCT CCNEDWRT CCNEFILT CCNEHIFC CCNEIPA3 CCNEIPAO CCNEMDEP CCNEOPTP CCNEP CCNEPP CCNETBY CCNMSGE CCNMSGT CCNQIPA
Fix information
Fixed component name
C/C++ FOR MVS
Fixed component ID
56551210A
Applicable component levels
R7C0 PSY UO03571
UP25/07/30 P F507
Fix is available
Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.
[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSTLTF","label":"z\/OS XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7C0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Document Information
Modified date:
02 August 2025