mingw is not fully ANSI, so %lf can break it
Bug #1552913 reported by
David Mathog
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape Devlibs |
Triaged
|
Medium
|
Unassigned |
Bug Description
The poppler library in devlibs 61 breaks (s)printf "%lf" formatting. The language standard says that "%lf" must work the same as "%f", and it does, except when programs are linked with poppler from devlibs 61. This was discovered while hunting down inkscape bug 1538361.
https:/
See message 40 in that thread for a test case and commands to reproduce the problem.
This is a major problem as it indirectly breaks almost all EMF/WMF imports on Windows.
The issue was introduced somewhere after devlibs 53, which was the version used the last time I did a Windows build.
To post a comment you must log in.
Made a new test program which is:
#include <stdlib.h> cos(esc) ,sin(esc) ,-sin(esc) ,-cos(esc) ); cos(esc) ,sin(esc) ,-sin(esc) ,-cos(esc) ); "%s\n", huge); EXIT_SUCCESS) ;
#include <stdio.h>
#include <math.h>
int main(void){
char huge[64000];
double esc=0;
double val = cos(esc);
printf("val %lf\n",val);
printf("esc %lf cos %lf sin %lf -sin %lf -cos %lf\n",
esc,
sprintf(huge,"esc %lf cos %lf sin %lf -sin %lf -cos %lf\n",
esc,
printf(
exit(
}
Obtained current release of Dr. Memory. Installed on XP 32 bit machine.
In a DOS window did:
mingwenv devlibs61/ lib -lpoppler bin\drmemory. exe" -logdir C:/temp/logs -- printf_bug
mingw32-g++ -O0 -ggdb -static-libgcc -static-libstdc++ -o printf_bug printf_bug.c -Lc:\progs\
"C:\Program Files\Dr. Memory\
This logged several errors in libpoppler (see attached)
then
delete printf_bug.exe bin\drmemory. exe" -logdir C:/temp/logs -- printf_bug
mingw32-g++ -O0 -ggdb -static-libgcc -static-libstdc++ -o printf_bug printf_bug.c
"C:\Program Files\Dr. Memory\
this logged no errors.
The error log from the first one is attached but it isn't very useful because libpoppler has no symbols in it.
Note that I also tried running this in the gdb debugger and using "stepi" to move into printf() and sprintf() functions. This was not helpful. "bt" did not show anything about where in poplar execution had gone.