[Bug c/92140] New: clang vs gcc optimizing with adc/sbb
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 Bug ID: 92140 Summary: clang vs gcc optimizing with adc/sbb Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: hermantenbrugge at home dot nl Target Milestone: --- The following code: extern char table[]; extern int c, v; void tst1 (void) { v += table[c] != 0; } void tst2 (void) { v -= table[c] != 0; } unsigned int tst3 (unsigned int n) { return n ? 2 : 1; } compiled with gcc and clang see some optimizing opportunities for gcc. Table with instruction generated: gccclang tst1: 53 tst2: 53 tst3: 43 This is with: gcc (GCC) 10.0.0 20191017 (experimental) clang version 10.0.0 (trunk 373843)
[Bug middle-end/82286] Wrong array subscript is above array bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82286 --- Comment #4 from Herman ten Brugge --- Created attachment 42238 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42238=edit modified test case I modified the testcase a little bit and did some debugging. The code outputs a failure if compiled with: gcc -O3 -Wall -c tst.c -DERROR -fdump-tree-cunrolli-details tst.c: In function 'mtrx_decompose_matrix': tst.c:34:17: warning: array subscript is above array bounds [-Warray-bounds] sum += tmp.data[row][sub]; The code is ok of compiled with: gcc -O3 -Wall -c tst.c -DERROR -fdump-tree-cunrolli-details -fno-aggressive-loop-optimizations or: gcc -O3 -Wall -c tst.c -fdump-tree-cunrolli-details The dumpfile that are created are in case of error containing or if -fno-aggressive-loop-optimizations is given: ... Analyzing # of iterations of loop 3 exit condition [0, + , 1](no_overflow) < row_8 bounds on difference of bases: 0 ... 4294967294 result: # of iterations row_8, bounded by 4294967294 ... The dumpfile looks correct in the case the sqrtf function is not used: ... Analyzing # of iterations of loop 3 exit condition [0, + , 1](no_overflow) < row_5 bounds on difference of bases: 0 ... 5 result: # of iterations row_5, bounded by 5 ... Something must go wrong when aggressive-loop-optimizations is enabled.
[Bug middle-end/82286] Wrong array subscript is above array bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82286 --- Comment #3 from Herman ten Brugge --- If I put: if (p_input_matrix->nof_rows > MAX_MATRIX_SIZE || p_input_matrix->nof_cols > MAX_MATRIX_SIZE) return; at the start of my function I still get the warning. I removed some assert statement at the start of the original code because they did nothing to preevent the warning.
[Bug c/82286] New: Wrong array subscript is above array bounds
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82286 Bug ID: 82286 Summary: Wrong array subscript is above array bounds Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: hermantenbrugge at home dot nl Target Milestone: --- Created attachment 42223 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42223=edit testcase The attached testcase reports array bound error if compiled with: gcc -O3 -Wall -c tst.c -DERROR tst.c: In function 'mtrx_decompose_matrix': tst.c:36:17: warning: array subscript is above array bounds [-Warray-bounds] sum += tmp.data[row][sub] * tmp.data[col][sub]; ^ If -DERROR is not given the testcase compiles with no warning.
[Bug c/82285] New: Optimizing error when using enumeration
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82285 Bug ID: 82285 Summary: Optimizing error when using enumeration Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: hermantenbrugge at home dot nl Target Milestone: --- Created attachment 42218 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42218=edit testcase The attached code initializes the data array wrong when using enumerations. If the code is changed to use integers it works. It also works if during initialization a printf is done. The code aborts if compiled with: gcc -O3 tst.c -o tst; ./tst The code works if compiled with: gcc -O3 tst.c -o tst -DPRINT; ./tst De code also works if compiled with -O2.
[Bug c/79374] New: missing sometimes-uninitialized warning in switch statement
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79374 Bug ID: 79374 Summary: missing sometimes-uninitialized warning in switch statement Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: hermantenbrugge at home dot nl Target Milestone: --- The code below: int tst(int); int tst (int sel) { int rv; switch (sel) { case 1: break; default: rv = 0; break; } return rv; } compiled with 'gcc -S -O3 -Wall tst.c' results in no warning in gcc 6.3.1 and gcc 7.0.1 (head) When compiled with clang 3.8.1 with same compiler options I get: tst.c:9:8: warning: variable 'rv' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized] case 1: break; ^ tst.c:13:10: note: uninitialized use occurs here return rv; ^~ tst.c:6:9: note: initialize the variable 'rv' to silence this warning int rv; ^ = 0 1 warning generated. This is a very reduced test case and in the real code it was much harder to see that rv was uninitialized. I now that bug '44042' was closed as 'RESOLVED WONTFIX' but clang gives the correct warning.
[Bug java/41549] New: [jni] very slow jni code callbacks
See mailing list: http://gcc.gnu.org/ml/java/2009-09/msg00030.html I have a problem with jni code callbacks. I have attached some code that shows the problem. The result of this code is: # results on fedora 11 # gcc/gcj 4.4.1 # kernel 2.6.30.5-43.fc11.x86_64 # openjdk fedora-29.b16.fc11-x86_64 # # open jdkgcj # no_jni 1.48 7.46( 5 times slower) # jni 66.70 17140.00(257 times slower) So when not using jni in this case gcj is 5 times slower. I suspect the jit compiler does a good for this small sample. The code with jni calls is however 257 timer slower. I really did not expect that. I also tried other java vm and they all have much better performance. So I expect a problem in the gcj library. When I use oprofile I see at lot of calls to execute_cfa_program and _Unwind_IteratePhdrCallback. -- Summary: [jni] very slow jni code callbacks Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hermantenbrugge at home dot nl GCC host triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41549
[Bug c/30916] Wrong �float� rather than �double� due to prototype warning
--- Comment #3 from hermantenbrugge at home dot nl 2007-02-23 15:26 --- Subject: Re: Wrong =?windows-1252?Q?=91float=92_rather_?= =?windows-1252?Q?than_=91double=92_due_to_prototype_warning?= manu at gcc dot gnu dot org wrote: --- Comment #2 from manu at gcc dot gnu dot org 2007-02-23 14:21 --- I think the warning is correct. If there were no prototype, the value would be passed as double. Since there is a prototype, the value is passed as float. That is what -Wconversion warns about up to GCC 4.2 (check the manual for the description of Wconversion). Since GCC 4.3, those warnings have been moved to Wtraditional-conversion and Wconversion has a new purpose. More info: http://gcc.gnu.org/wiki/NewWconversion (Please, notice that the project is not finished yet, so things may change before GCC 4.3 is released). Please, let us know if this answers your question, so we can close this bug report. Yes. This answers the question. Sorry about the noise. I was testing this with gcc version 4.1.1 20070105 (Red Hat 4.1.1-51) on fedora core 6. When I use gcc version 4.3.0 20070222 (experimental). The problem goes away. So the problem report can be closed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30916
[Bug c/30916] New: Wrong �float� rather than �double� due to prototype warning
The following code: void func (float a); void func (float a) { } int main (void) { func (3.0f); return 0; } Compiled with: gcc -Wconversion bug.c produces: bug.c: In function main: bug.c:10: warning: passing argument 1 of func as float rather than double due to prototype I was not expecting this. When looking at the code in c-typeck.c at line 2473. I see: /* Warn if any argument is passed as `float', since without a prototype it would be `double'. */ if (formal_prec == TYPE_PRECISION (float_type_node) type != dfloat32_type_node) Should the dfloat32_type_node be changed into float_type_node? When I change this no warning is produced anymore. -- Summary: Wrong float rather than double due to prototype warning Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hermantenbrugge at home dot nl GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30916
[Bug libmudflap/21023] mudflap reports errors for external variables
-- What|Removed |Added Summary|mudflap reports errors |mudflap reports errors for ||external variables Version|4.0.1 |4.0.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21023
[Bug libmudflap/21023] New: mudflap reports errors
Yesterday I upgraded my fedora core 3 instalation and got gcc4 installed. I tested the mudflap code and found a problem. The reduced test case is below. when I have two programs a.c and b.c -- a.c -- typedef struct { char *name; } dummy; dummy d[] = { {a}, {0} }; -- b.c -- typedef struct { char *name; } dummy; extern dummy d[]; int main (void) { dummy *pd = d; while (pd-name) { printf (%s\n, pd-name); pd++; } } and compile this with: gcc4 -fmudflap a.c b.c -o a -lmudflap when I run the program I get: a *** mudflap violation 1 (check/read): time=1113495140.046642 ptr=0x8049a00 size=4 pc=0xb7eff322 location=`b.c:9 (main)' /usr/lib/libmudflap.so.0(__mf_check+0x44) [0xb7eff322] ./a(main+0x8b) [0x8048787] /usr/lib/libmudflap.so.0(__wrap_main+0x1d8) [0xb7f0004e] Nearby object 1: checked region begins 8B before and ends 5B before mudflap object 0x80ca090: name=`__mf_lc_mask' bounds=[0x8049a08,0x8049a0b] size=4 area=no-access check=0r/0w liveness=0 alloc time=1113495140.046375 pc=0xb7effe0a Nearby object 2: checked region begins 16B before and ends 13B before mudflap object 0x80ca028: name=`__mf_lookup_cache' bounds=[0x8049a10,0x80c9a0f] size=524288 area=no-access check=0r/0w liveness=0 alloc time=1113495140.046371 pc=0xb7effe0a number of nearby objects: 2 There should be no error. I think the problem is in tree-mudflap.c in function mudflap_finish_file. Here is a check for TREE_STATIC. I think this should be !TREE_PUBLIC ??? I assigned this to 4.0.1 because I probably can not assign this to 4.0.0 anymore? -- Summary: mudflap reports errors Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libmudflap AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hermantenbrugge at home dot nl CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i386-redhat-linux GCC host triplet: i386-redhat-linux GCC target triplet: i386-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21023
[Bug target/19859] New: SImode and DImode usage
:74:typedef int Int32_t __attribute ((mode (SI))); ./libstdc++-v3/libmath/mathconf.h:75:typedef unsigned int U_int64_t __attribute ((mode (DI))); ./libstdc++-v3/libmath/mathconf.h:76:typedef int Int64_t __attribute ((mode (DI))); ./libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h:41: __extension__ typedef int __guard __attribute__((mode (__DI__))); ./libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h:59: __extension__ typedef int __guard __attribute__((mode (__DI__))); -- Summary: SImode and DImode usage Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hermantenbrugge at home dot nl CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: c4x http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19859