This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Infinite loop in dcraw with current GCC versions
- From: dcoffin at shell dot cybercom dot net
- To: conchur at web dot de
- Cc: "René Rebe ExactCODE" <rene at exactcode dot com>, Sven Eckelmann <sven at narfation dot org>, gcc-help at gcc dot gnu dot org
- Date: Fri, 27 Feb 2015 11:46:28 -0500
- Subject: Re: Infinite loop in dcraw with current GCC versions
- Authentication-results: sourceware.org; auth=none
- References: <trinity-60134df2-c869-4dd4-b0fc-42de47b7904e-1425033032972 at 3capp-webde-bs13>
This sounds like a compiler bug to me. A statement
of the form:
for (i=0; i < 12; i++) {
<code that doesn't change "i">
}
should never generate an infinite loop.
I ran my last full test (over 2000 raw photos) with
GCC 4.9.1 and the options:
gcc -O4 -march=native -fomit-frame-pointer \
-Wall -Wno-aggressive-loop-optimizations -Wno-maybe-uninitialized -Wno-unused-result -Wno-array-bounds \
dcraw.c -lm -ljasper -ljpeg -llcms2 -s
Dave Coffin 2/27/2015
On Fri, Feb 27, 2015 at 11:30:33AM +0100, conchur@web.de wrote:
> Hi,
>
> I think you know about the problem of undefined behavior in you dcraw code [1].
> This can lead to very bad things like infinite loops. Is there any progress or
> way to support you in fixing this?
>
> I know that there are some patches floating around like
>
> https://sources.debian.net/src/exactimage/0.9.1-2/debian/patches/gcc_48_dcraw_infinite_loop.patch/
>
> But they seem to be against older versions of dcraw.
>
> A good way to test against such problems is to use following CFLAGS:
>
> -g3 -fsanitize=undefined -fsanitize=address -Wall
>
> and then run your testset of images against them + recording
> the error messages.
>
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54136#c5