Package: pstotext
Version: 1.9-4
Severity: normal

When downloaded and built as is with recent gcc versions, pstotext does not
work because optimizations broke the code:

The following code
--- ptotdll.c --
[...]
static int ReadChar(char **instr) {
  int c = **(unsigned char**)instr;
  (*instr)++;
  return c;
}

[...]

static int ReadInt(char **instr) {
  int i = 0;
  int sign = 1;
  int c;
  while ((c = ReadChar(instr))==' ') /* skip */ ;
[...]
----

is when compiled on  amd64 with gcc (Debian 4.4.4-5) 4.4.4 and 
make CC="gcc -g -Wall -DNEED_PROTO -O2"
results to

----
Dump of assembler code for function ReadInt:
0x0000000000401960 <ReadInt+0>: mov    (%rdi),%rdx
0x0000000000401963 <ReadInt+3>: mov    %rdx,%rax
0x0000000000401966 <ReadInt+6>: nopw   %cs:0x0(%rax,%rax,1)
0x0000000000401970 <ReadInt+16>:        movzbl (%rax),%ecx
0x0000000000401973 <ReadInt+19>:        add    $0x1,%rdx
0x0000000000401977 <ReadInt+23>:        mov    %rdx,(%rdi)
0x000000000040197a <ReadInt+26>:        cmp    $0x20,%ecx
0x000000000040197d <ReadInt+29>:        je     0x401970 <ReadInt+16>
----

which seems to be bound to end in infinite loop unless leaving the cycle on
the first iteration.

The quick solution to this problem is to use -fno-strict-aliases for
compilation.


Jan Jeroným Zvánovec

-- System Information:
Debian Release: squeeze/sid
  APT prefers stable
  APT policy: (700, 'stable'), (650, 'testing'), (600, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages pstotext depends on:
ii  ghostscript-x [gs- 8.62.dfsg.1-3.2lenny1 The GPL Ghostscript PostScript/PDF
ii  gs-gpl             8.62.dfsg.1-3.2lenny1 Transitional package
ii  libc6              2.11.1-3              Embedded GNU C Library: Shared lib

pstotext recommends no packages.

pstotext suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to