public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Aaron Coleman" <acoleman@lowrance.com>
To: <gcc-bugs@gcc.gnu.org>
Subject: signed enum bug
Date: Fri, 25 Feb 2005 21:35:00 -0000	[thread overview]
Message-ID: <911AD4A0E942864C9F9E02A630C88EC603519E27@exchsrvr.lowrance.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 952 bytes --]

[My first time at reporting, so please bear with me if I do something wrong...]
 
The compiler outputs a bg branch instruction when it should use a bgu. The cause seems to be related to having a negative value in the enumeration. If I just comment out the DummyValue1 line, the code is correct. It does this at any optimization level of 1 or higher, and I haven't figured out if there is a specific optimization I can turn off as a work around.
 
      add   %o0, -2, %o0
      cmp   %o0, 1
      .stabn 68,0,13,.LLM3-_Z13DummyFunction10tTestEnum2
.LLM3:
      .stabn 68,0,15,.LLM4-_Z13DummyFunction10tTestEnum2
.LLM4:
      bg    .LL2
      mov   0, %o0
      .stabn 68,0,16,.LLM5-_Z13DummyFunction10tTestEnum2
.LLM5:
      mov   2, %o0
.LL2:
.LLBE3:
.LLBE2:
      retl
      nop
 
 
 
Thanks,
Aaron Coleman
Software Engineering Manager
Lowrance Electronics, Inc.
12000 E Skelly Dr.
Tulsa, OK 74128
918-437-6881 x8551
 

[-- Attachment #2: test.ii --]
[-- Type: application/octet-stream, Size: 343 bytes --]

# 1 "test.cpp"
# 1 "/cygdrive/f/Projects/TestApp_Memory/Main//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cpp"

enum tTestEnum2
{
 DummyValue1 = -1,
 DummyValue2,
 DummyValue3,
 DummyValue4,
 DummyValue5,
};

int DummyFunction(tTestEnum2 Enum)
{
 long Ret = 0;

 if(Enum == DummyValue4 || Enum == DummyValue5)
  Ret = 2;

 return Ret;
}

[-- Attachment #3: output.txt --]
[-- Type: text/plain, Size: 1744 bytes --]

Reading specs from /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/specs
Configured with: /gcc_src/gcc-3.4-20040317/configure --prefix=/compilers/sparc-elf --target=sparc-elf --enable-languages=c++ --with-newlib --enable-clocale=generic --enable-cxx-flags=-fno-exceptions --disable-hosted-libstdcxx
Thread model: single
gcc version 3.4.0 20040317 (prerelease)
 /compilers/sparc-elf/libexec/gcc/sparc-elf/3.4.0/cc1plus.exe -E -quiet -v -D__sparc_v8__ -D__sparc_v8__ test.cpp -mcpu=v8 -mcpu=v8 -mtune=v8 -mv8 -m32 -Werror -Wall -fworking-directory -O1 -o test.ii
ignoring nonexistent directory "/compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../include/c++/3.4.0/backward"
ignoring nonexistent directory "/compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../sparc-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../include/c++/3.4.0
 /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../include/c++/3.4.0/sparc-elf
 /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/include
 /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../sparc-elf/include
End of search list.
 /compilers/sparc-elf/libexec/gcc/sparc-elf/3.4.0/cc1plus.exe -fpreprocessed test.ii -mcpu=v8 -quiet -dumpbase test.cpp -mcpu=v8 -mtune=v8 -mv8 -m32 -auxbase-strip test.o -g -O1 -Werror -Wall -version -o test.s
GNU C++ version 3.4.0 20040317 (prerelease) (sparc-elf)
	compiled by GNU C version 3.3.1 (cygming special).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../sparc-elf/bin/as.exe -V -Qy -s -o test.o test.s
GNU assembler version 040202 (sparc-elf) using BFD version 040202 20040202

             reply	other threads:[~2005-02-25 16:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-25 21:35 Aaron Coleman [this message]
2005-02-25 22:23 ` Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=911AD4A0E942864C9F9E02A630C88EC603519E27@exchsrvr.lowrance.com \
    --to=acoleman@lowrance.com \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).