This is the mail archive of the gcc-prs@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]

optimization/10409: "__attribute__((const))" apparently not working for ARM


>Number:         10409
>Category:       optimization
>Synopsis:       "__attribute__((const))" apparently not working for ARM
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 15 03:56:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Pete Gonzalez
>Release:        GCC 3.2.1 (C compiler)
>Organization:
>Environment:
Cross compiler running on Win32/Cygwin with target CPU "arm7tdmi" (ARM mode)
>Description:
The "const" function attribute apparently has no effect when compiling for the arm7tdmi target CPU.  In contrast, if I compile the same code for an i386 target, the two calls to "pure_func(x)" are correctly optimized into a single call.

This seems strange, because this optimization seems like it would occur at a higher level, before machine-specific issues are considered.  (?)

_______________

int pure_func(int x) __attribute__((const));

int test(int x) {
  return pure_func(x) + pure_func(x);
}

>How-To-Repeat:
Save the above code as "test.c" and then run "gcc -c -O2 -save-temps test.c".
>Fix:
I'm uncertain as to whether this is a bug or just a missing feature.
>Release-Note:
>Audit-Trail:
>Unformatted:


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