This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


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

Optimisation bug (?)


I have a piece of code that reads in .SGI format image files and is
pretty long (so I've not
posted it here). The problem is that doing a

    gcj -O3 --no-bounds-check  -c SgiFile.java -o SgiFile.o

produces the following errors when I try to link the program...

gcj -O3 --no-bounds-check -o vspoold main.o Configuration.o Connection.o
Directo
ryManager.o Server.o Security.o HeaderManager.o SgiFile.o
natConnection.o jpgMem
Dst.o --main=main -Ljpeg -ljpeg
SgiFile.o: In function `SgiFile::getMagic(void)':
SgiFile.o(.text+0x110c): undefined reference to `SgiFile::getWord(int)'
SgiFile.o: In function `SgiFile::getX(void)':
SgiFile.o(.text+0x1124): undefined reference to `SgiFile::getWord(int)'
SgiFile.o: In function `SgiFile::getY(void)':
SgiFile.o(.text+0x113c): undefined reference to `SgiFile::getWord(int)'
SgiFile.o: In function `SgiFile::getZ(void)':
SgiFile.o(.text+0x1154): undefined reference to `SgiFile::getWord(int)'
SgiFile.o: In function `SgiFile::getDimension(void)':
SgiFile.o(.text+0x116c): undefined reference to `SgiFile::getWord(int)'
SgiFile.o: In function `SgiFile::getPixMin(void)':
SgiFile.o(.text+0x1184): undefined reference to `SgiFile::getLong(int)'
SgiFile.o: In function `SgiFile::getPixMax(void)':
SgiFile.o(.text+0x119c): undefined reference to `SgiFile::getLong(int)'
collect2: ld returned 1 exit status

   o getWord() and getLong() are the only private methods in the file
   o the code *compiles* fine, it's at the linking stage there is a
problem
   o the problem goes away when I'm not optimising (i.e: no -O3 ...)
   o the problem goes away if I make the methods public not private.

So, it looks as though private methods are a bit *too* private when used

with optimisation, or I'm missing something (probably blindingly obvious
:-)

ATB,
    Simon.



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