Fixes are available
APAR status
Closed as program error.
Error description
Consider the following example: cat $test.c #include <stdio.h> #include <stdlib.h> #define TOKENSTRING " ,;\t\15\n" #define FALSE 0 #define TRUE 1 static char *MyToken ( char *String, char *Delimiter ); int main ( void ) { char TestString[80]; char *s; sprintf ( TestString, "type var '[s] testfall'" ); s = MyToken ( TestString, TOKENSTRING ); printf ( "1 <%s>\n", s ); while ( s != NULL ) { s = MyToken ( NULL, TOKENSTRING ); printf ( "2 <%s>\n", s ); } return ( 0 ); } static char *MyToken ( char *String, char *Delimiter ) { /*-------------------------------------------------------------- / Do not account for delimiters found in [] or ''. / /------------------------------------------------------------* / static char *p = NULL; char *s, *Begin; int BracketOpen, Apostroph; if ( String != NULL ) p = String; else if ( p == NULL ) return ( NULL ); BracketOpen = Apostroph = FALSE; Begin = p; /*-------------------------------------------------------------- / '\0' and '\n' are taken as delimiters too. / /-------------------------------------------------------------*/ while ( (*p != '\0') && (*p != '\n') ) { /*------------------------------------------------------------ - / Account for [ and '. / Within brackets and apostrophs, / / no delimiters shall be evaluated. / ----------------------------------------------------- - -----*/ if ( *p == '[' ) BracketOpen = TRUE; if ( *p == '\'') Apostroph = !Apostroph; if ( !(BracketOpen || Apostroph) ) { /*------------------------------------------------------------- / We are outside brackets or apostrophs; / / thus we can evaluate the delimiter. / /------------------------------------------------------------*/ s = Delimiter; while ( *s != '\0' ) { if ( *p == *s ) { *p++ = '\0'; return ( Begin ); } s++; } } if ( *p == ']' ) BracketOpen = FALSE; p++; } if ( p != Begin ) { *p = '\0'; return ( Begin ); } else return ( NULL); } Compile it with -O2 and execute the binary: xlc -O2 test.c ./a.out Expected output: ./a.out 1 <type> 2 <var> 2 <'[s] testfall'> 2 <> <end of output> but the binary generates the following output: ./a.out 1 <type> 2 <var> 2 <'[s]> 2 <testfall'> 2 <> <end of output>
Local fix
Compile with noopt or -O3 and above.
Problem summary
Incorrect optimization
Problem conclusion
The problem had been fixed
Temporary fix
Comments
APAR Information
APAR number
LI77977
Reported component name
XL C/C++ FOR LI
Reported component ID
5725C7300
Reported release
C10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2014-04-30
Closed date
2014-04-30
Last modified date
2014-04-30
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
XL C/C++ FOR LI
Fixed component ID
5725C7300
Applicable component levels
RC10 PSY
UP
[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1","Line of Business":{"code":"LOB57","label":"Power"}}]
Document Information
Modified date:
16 October 2021