This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Infinite loop in dcraw with current GCC versions


     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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]