Package: cairo Version: 1.12.16-2 Severity: minor Usertags: goto-cc During a rebuild of all Debian packages in a clean sid chroot (using cowbuilder and pbuilder) the build failed with the following error. Please note that we use our research compiler tool-chain (using tools from the cbmc package), which permits extended reporting on type inconsistencies at link time.
[...] gcc -DHAVE_CONFIG_H -I. -I/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/test -I.. -I/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/test -I/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/test/pdiff -I/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/boilerplate -I/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/util/cairo-missing -I/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/util/cairo-script -I/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/src -I../src -D_REENTRANT -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/libdrm -I/usr/include/libpng12 -Wall -Wextra -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Werror-implicit-function-declaration -Wnested-externs -Wpointer-arith -Wwrite-strings -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wbad-function-cast -Wvolatile-register-var -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing -fno-common -Wp,-D_FORTIFY_SOURCE=2 -Wno-unused-but-set-variable -D_FORTIFY_SOURCE=2 -D_REENTRANT -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -MT cairo_test_suite-path-precision.o -MD -MP -MF .deps/cairo_test_suite-path-precision.Tpo -c -o cairo_test_suite-path-precision.o `test -f 'path-precision.c' || echo '/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/test/'`path-precision.c file /srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/test/path-precision.c line 40 function draw: in expression `95.000000': conversion from `double' to `int': implicit conversion not permitted CONVERSION ERROR Makefile:5710: recipe for target 'cairo_test_suite-path-precision.o' failed make[5]: *** [cairo_test_suite-path-precision.o] Error 64 make[5]: Leaving directory '/srv/jenkins-slave/workspace/sid-goto-cc-cairo/cairo-1.12.16/debian/build/main/test' Makefile:8060: recipe for target 'all-recursive' failed make[4]: *** [all-recursive] Error 1 Review the code here: http://sources.debian.net/src/cairo/1.12.16-2/test/path-precision.c?hl=40#L38 The issue is that cairo_path_data_t is a union, and such compound literals will always use the first component of the union for initialisation. Hence double values like 95.0 are necessarily converted to whatever the representation of the enum is, such as int. Use the attached extracted test to convince yourself. The net result is that this test (path-precision.c) will possibly fail for the entirely wrong reason (it is expected to fail), providing zero test value. Best, Michael
#include <assert.h> #include <stdio.h> typedef enum _cairo_path_data_type { CAIRO_PATH_MOVE_TO, CAIRO_PATH_LINE_TO, CAIRO_PATH_CURVE_TO, CAIRO_PATH_CLOSE_PATH } cairo_path_data_type_t; typedef union _cairo_path_data_t cairo_path_data_t; union _cairo_path_data_t { struct { cairo_path_data_type_t type; int length; } header; struct { double x, y; } point; }; int main() { cairo_path_data_t path_data[] = { { { CAIRO_PATH_MOVE_TO, 2 }, }, { { 95.000000, 40.000000 }, }, { { CAIRO_PATH_LINE_TO, 2 }, }, { { 94.960533, 41.255810 }, }, { { CAIRO_PATH_LINE_TO, 2 }, }, { { 94.842293, 42.50666 }, }, { { CAIRO_PATH_LINE_TO, 2 }, }, { { 94.645744, 43.747627 }, }, { { CAIRO_PATH_LINE_TO, 2 }, }, { { 94.371666, 44.973797 }, }, }; printf("path_data[1].point.x=%f\n", path_data[1].point.x); assert(path_data[1].point.x==95.0); return 0; }
pgpO5IbltHgT0.pgp
Description: PGP signature