Frama-C Bug Tracking System - Frama-C
View Issue Details
0001467Frama-CKernelpublic2013-08-07 14:122017-06-09 19:55
pascal 
valentin.perrelle 
normalfeaturealways
resolvedfixed 
Frama-C Fluorine-20130601 
Frama-C GIT, precise the release id 
0001467: Parser does not handle mixed concatenations of wide and non-wide strings
~/ppc $ cat tests/misc/wstring_phase6.i
/* run.config
   OPT: -journal-disable -print
*/

// See http://stackoverflow.com/questions/18102502/mixing-wide-and-narrow-string-literals-in-c [^]
main(){
printf( "%s\n", "123" "456" );
printf( "%ls\n", L"123" L"456" );
printf( "%ls\n", "123" L"456" );
printf( "%ls\n", L"123" "456" );
printf( "%ls\n", L"123" L"456" );
}
~/ppc $ bin/toplevel.opt -print tests/misc/wstring_phase6.i
tests/misc/wstring_phase6.i:9:[kernel] user error: syntax error
[kernel] user error: skipping file "tests/misc/wstring_phase6.i" that has errors.
[kernel] Frama-C aborted: invalid user input.
~/ppc $
As commented in the test, the behavior is defined and is explained in http://stackoverflow.com/questions/18102502/mixing-wide-and-narrow-string-literals-in-c [^]
No tags attached.
Issue History
2013-08-07 14:12pascalNew Issue
2013-09-07 11:20yakobowskiNote Added: 0004064
2013-09-07 11:20yakobowskiAssigned To => pascal
2013-09-07 11:20yakobowskiSeveritytrivial => feature
2013-09-07 11:20yakobowskiStatusnew => assigned
2013-09-07 11:20yakobowskiAdditional Information Updated
2013-09-09 14:19svnCheckin
2016-07-05 17:34yakobowskiAssigned Topascal =>
2016-07-05 17:34yakobowskiStatusassigned => confirmed
2017-05-04 15:55yakobowskiAssigned To => valentin.perrelle
2017-05-04 15:55yakobowskiStatusconfirmed => assigned
2017-06-09 19:55virgileNote Added: 0006406
2017-06-09 19:55virgileStatusassigned => resolved
2017-06-09 19:55virgileResolutionopen => fixed
2017-06-09 19:55virgileFixed in Version => Frama-C GIT, precise the release id

Notes
(0004064)
yakobowski   
2013-09-07 11:20   
There is already a comment to that effect in cil/src/front/clexer.mll. Search for "matth: BUG: this could be either a regular string or a wide string.". Fixing the lexer does not seem easy.

Fixing the parser is also complicated. The productions for wstring_list and string_list do not have the same type, so it is not possible to switch from a non-wide string to a wide one when we finally notice a L. And inside an LALR(1) parser, we cannot look at the token stream to see if an L is coming.
(0006406)
virgile   
2017-06-09 19:55   
Fixed in dev. Will appear in FC 16 Sulfur