D
David RF
HI friends, splint doesn't like this:
#include <stdio.h>
#define ctos(x) (char[2]){(char)x, '\0'}
int main(void)
{
int c = 'a';
printf("%s %s\n", ctos(c), ctos('b'));
return 0;
}
But I can't see the problem
david@debian:~$ splint *.c
Splint 3.1.2 --- 23 Aug 2008
demo.c: (in function main)
demo.c:7:10: Variable c initialized to type char, expects int: 'a'
A character constant is used as an int. Use +charintliteral to allow
character constants to be used as ints. (This is safe since the
actual type
of a char constant is int.)
constraintGeneration.c:2149: at source point
demo.c:11:2: *** Internal Bug at constraintGeneration.c:2149: llassert
failed:
exprNode_isDefined(el) [errno: 25]
*** Please report bug to (e-mail address removed) (via reportbug)
***
(attempting to continue, results may be incorrect)
*** Segmentation Violation
*** Location (not trusted): demo.c:11:2
*** Last code point: transferChecks.c:4415
*** Previous code point: transferChecks.c:4002
*** Please report bug to (e-mail address removed) (via reportbug)
*** A useful bug report should include everything we need to reproduce
the bug.
#include <stdio.h>
#define ctos(x) (char[2]){(char)x, '\0'}
int main(void)
{
int c = 'a';
printf("%s %s\n", ctos(c), ctos('b'));
return 0;
}
But I can't see the problem
david@debian:~$ splint *.c
Splint 3.1.2 --- 23 Aug 2008
demo.c: (in function main)
demo.c:7:10: Variable c initialized to type char, expects int: 'a'
A character constant is used as an int. Use +charintliteral to allow
character constants to be used as ints. (This is safe since the
actual type
of a char constant is int.)
constraintGeneration.c:2149: at source point
demo.c:11:2: *** Internal Bug at constraintGeneration.c:2149: llassert
failed:
exprNode_isDefined(el) [errno: 25]
*** Please report bug to (e-mail address removed) (via reportbug)
***
(attempting to continue, results may be incorrect)
*** Segmentation Violation
*** Location (not trusted): demo.c:11:2
*** Last code point: transferChecks.c:4415
*** Previous code point: transferChecks.c:4002
*** Please report bug to (e-mail address removed) (via reportbug)
*** A useful bug report should include everything we need to reproduce
the bug.