Problem is caused by gcc optimizations ("-O2"). Building without optimizations using DEB_BUILD_OPTIONS="nostrip noopt" and gcc-4.5 (4.5.1-9ubuntu1) results in expected behaviour of "dpkg-query -l".
This looks like a bug in gcc since a rebuild using gcc-4.4 (4.4.5-2ubuntu1) *with* "-O2" gives expected behaviour (ie no SIGSEGV).
Problem is caused by gcc optimizations ("-O2"). Building without optimizations using DEB_BUILD_ OPTIONS= "nostrip noopt" and gcc-4.5 (4.5.1-9ubuntu1) results in expected behaviour of "dpkg-query -l".
This looks like a bug in gcc since a rebuild using gcc-4.4 (4.4.5-2ubuntu1) *with* "-O2" gives expected behaviour (ie no SIGSEGV).
Tested with libc-2. 12.1-0ubuntu9.