Opened 9 years ago
Closed 7 years ago
#2787 closed defect (fixed)
grass-7.0.1: compiling on Gentoo shows warnings when built with -Wagressive-loop-optimizations
Reported by: | wraeth | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.4.0 |
Component: | Compiling | Version: | 7.0.1 |
Keywords: | i.aster.toar | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description
- QA Notice: Package triggers severe warnings which indicate that it
- may exhibit random runtime failures.
- main.c:312:2: warning: iteration 14u invokes undefined behavior [-Waggressive-loop-optimizations]
- main.c:308:6: warning: iteration 14u invokes undefined behavior [-Waggressive-loop-optimizations]
- main.c:278:6: warning: iteration 14u invokes undefined behavior [-Waggressive-loop-optimizations]
- aerosolmodel.cpp:619:59: warning: iteration 82u invokes undefined behavior [-Waggressive-loop-optimizations]
This appears to be coming from the files:
imagery/i.aster.toar/main.c imagery/i.atcorr/aerosolmodel.cpp
Compile log to follow.
Attachments (1)
Change History (13)
by , 9 years ago
Attachment: | grass-7.0.1:201510300002.log.gz added |
---|
comment:1 by , 9 years ago
Formatting messed the lines. The errors are produced when compiling the files imagery/i.aster.toar/main.c
and imagery/i.atcorr/aerosolmodel.cpp
follow-up: 3 comment:2 by , 9 years ago
Replying to wraeth:
- main.c:312:2: warning: iteration 14u invokes undefined behavior [-Waggressive-loop-optimizations]
- main.c:308:6: warning: iteration 14u invokes undefined behavior [-Waggressive-loop-optimizations]
- main.c:278:6: warning: iteration 14u invokes undefined behavior [-Waggressive-loop-optimizations]
imagery/i.aster.toar/main.c
77 /*File Descriptors */ 78 int infd[MAXFILES]; 79 int outfd[MAXFILES];
277 for (i = 1; i <= MAXFILES; i++) 278 Rast_get_row(infd[i], inrast[i-1], row, in_data_type[i-1]);
307 for (i = 1; i <= MAXFILES; i++) 308 Rast_put_row(outfd[i], outrast[i-1], out_data_type);
310 for (i = 1; i <= MAXFILES; i++) { 311 G_free(inrast[i-1]); 312 Rast_close(infd[i]); 313 G_free(outrast[i-1]); 314 Rast_close(outfd[i]); 315 }
i can be equal to MAXFILES, which is the size of infd and outfd, so accessing infd[i] and outfd[i] is undefined behaviour.
- aerosolmodel.cpp:619:59: warning: iteration 82u invokes undefined behavior [-Waggressive-loop-optimizations]
imagery/i.atcorr/common.h
51 float phasel[10][83];
imagery/i.atcorr/aerosolmodel.cpp
619 for (int k = 1; k <= 83; ++k) sixs_sos.phasel[i][k] = 0.f;
Similar issue.
Was this converted from Fortran?
comment:3 by , 9 years ago
Milestone: | → 7.0.1 |
---|
comment:4 by , 9 years ago
Keywords: | i.aster.toar added |
---|---|
Milestone: | 7.0.1 → 7.0.3 |
comment:7 by , 9 years ago
Milestone: | 7.0.4 → 7.0.5 |
---|
comment:8 by , 8 years ago
Milestone: | 7.0.5 → 7.3.0 |
---|
comment:12 by , 7 years ago
Milestone: | 7.4.1 → 7.4.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Type: | enhancement → defect |
I have now compiled relbranch74 (a.k.a. 7.4.0) with -Waggressive-loop-optimizations and the above reported i.atcorr compilation issues are fixed after Markus Metz's latest improvements.
Closing, feel free to reopen if needed.
Compressed build output