public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with Apple's customised gcc compiler
@ 2004-03-13 19:40 Tony Han Bao
  2004-03-14 21:09 ` Eljay Love-Jensen
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Han Bao @ 2004-03-13 19:40 UTC (permalink / raw)
  To: gcc-help

Dear all,

I'm a third year computer science student from University of Wales, 
Swansea. First time using this mailing list, I need some help.

There is a problem regarding Apple's customised gcc compiler.

Current default compiler:
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)

I was working on a project when I discovered this rather strange error.

This project uses C++ templates and generic programming heavily. Inside 
a class, I wrote a toy member function as follows,

void debug() {
return 1;
}

However this obvious error was not reported by the compiler when 
compiling the entire (rather large) project.

Then I wrote the same function in a separate file and tried to compile 
that file, the error was then reported by the same compiler.

My questions are:

Is there a known bug in the above compiler that caused this?

If not, could this be a bug?

Or could there be some other problem that causes the compiler to behave 
like this?

Could it be that the compiler optimised away some code and over looked 
this error? Is there any compiler options that could enforce this error 
checking?

One last unrelated question, can I use the true gcc compiler (not 
apple's customised version) on a mac?

Thank you all for your time, please help.

Tony 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with Apple's customised gcc compiler
  2004-03-13 19:40 problem with Apple's customised gcc compiler Tony Han Bao
@ 2004-03-14 21:09 ` Eljay Love-Jensen
  2004-03-18 15:26   ` Tony Han Bao
  0 siblings, 1 reply; 4+ messages in thread
From: Eljay Love-Jensen @ 2004-03-14 21:09 UTC (permalink / raw)
  To: Tony Han Bao, gcc-help

Hi Tony,

Both as C and C++ the code returned a warning for me.

Using Apple's GCC 3.3 20030304 Build 1495.

gcc -c bug.c

g++ -c bug.cpp

 >Is there a known bug in the above compiler that caused this?

Would you retry compiling your code snippet.  Since it generated a warning 
for me, I'm surprised / concerned.

 >Or could there be some other problem that causes the compiler to behave 
like this?

Do you have warnings suppressed?  What was your command line?

 >Could it be that the compiler optimised away some code and over looked 
this error?

No.

 >Is there any compiler options that could enforce this error checking?

g++ -pedantic -Werror -Wall -W -c bug.cpp

 >One last unrelated question, can I use the true gcc compiler (not apple's 
customised version) on a mac?

Do you merely want to run your code at the Darwin level?  Then yes.

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with Apple's customised gcc compiler
  2004-03-14 21:09 ` Eljay Love-Jensen
@ 2004-03-18 15:26   ` Tony Han Bao
  2004-03-18 16:04     ` Eljay Love-Jensen
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Han Bao @ 2004-03-18 15:26 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: gcc-help

Hi Eljay

Thank you for your reply.

I did use the -w option which would explain why there is no warning 
messages. But this surly must be an error not a warning.

I tried turn on -W, and also the line g++ -pedantic -Werror -Wall -W -c 
bug.cpp

The compiler generated only a warning.

Should I report this to Apple?

By the way, could I use the true gcc compiler and Apple's customised 
version on the same machine without conflict? How do I do this?

Thank you very much.

Tony
On Mar 13, 2004, at 5:14 pm, Eljay Love-Jensen wrote:

> Hi Tony,
>
> Both as C and C++ the code returned a warning for me.
>
> Using Apple's GCC 3.3 20030304 Build 1495.
>
> gcc -c bug.c
>
> g++ -c bug.cpp
>
> >Is there a known bug in the above compiler that caused this?
>
> Would you retry compiling your code snippet.  Since it generated a 
> warning for me, I'm surprised / concerned.
>
> >Or could there be some other problem that causes the compiler to 
> behave like this?
>
> Do you have warnings suppressed?  What was your command line?
>
> >Could it be that the compiler optimised away some code and over 
> looked this error?
>
> No.
>
> >Is there any compiler options that could enforce this error checking?
>
> g++ -pedantic -Werror -Wall -W -c bug.cpp
>
> >One last unrelated question, can I use the true gcc compiler (not 
> apple's customised version) on a mac?
>
> Do you merely want to run your code at the Darwin level?  Then yes.
>
> HTH,
> --Eljay
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with Apple's customised gcc compiler
  2004-03-18 15:26   ` Tony Han Bao
@ 2004-03-18 16:04     ` Eljay Love-Jensen
  0 siblings, 0 replies; 4+ messages in thread
From: Eljay Love-Jensen @ 2004-03-18 16:04 UTC (permalink / raw)
  To: Tony Han Bao; +Cc: gcc-help

Hi Tony,

 >But this surly must be an error not a warning. ... The compiler generated 
only a warning.

No, it's not an error.  Strange as that may seem.  Part of the C legacy.

To put it in assembly terms:  you are allowed to populate the registers 
with whatever information you want before returning to the caller.  Even if 
your assembly routine's "contract" doesn't explicitly state that any 
registers will have some useful information in them.

C is closer in spirit (in my opinion) to a macro assembly language (say, 
Macro68 for the Amiga).  C++ is closer in spirit to higher level languages 
(say, Smalltalk, Lisp, or Simula).

Now that's merely my opinion; I'm not trying to start a flame war over what 
language is "better" than another.  All languages have their place... even 
ones like False and Brainf**k.  Computer languages are just tools; some 
tools are better suited for particular tasks than other tools.

"When C++ is your hammer, all your problems look like thumbs."
~ Eric Scouten

 >Should I report this to Apple?

No.  It's not a bug.

 >By the way, could I use the true gcc compiler and Apple's customised 
version on the same machine without conflict? How do I do this?

I would compile the GCC compiler such that it would reside in your home 
directory (e.g., /Users/tonybao/gcc/...), which you can configure during 
the, er, umm, configure process.

For information as to the care-and-feeding (set up and install) of GCC, 
please read the manuals <http://gcc.gnu.org/onlinedocs/>/

Side note:  Apple's tweaked/custom version of GCC is a "true GCC 
compiler".  I presume what you meant was "...a vanilla gcc compiler...".

Another way you can use a vanilla GCC, is to install Darwin (sans OS 
X).  That should be more like a GNU/Linux-ish experience.  Please, FreeBSD 
and Darwin aficionados, don't throw rotten tomatoes at me for the Linux 
comparison.  They're all cool.  I consider that a compliment.

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-18 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-13 19:40 problem with Apple's customised gcc compiler Tony Han Bao
2004-03-14 21:09 ` Eljay Love-Jensen
2004-03-18 15:26   ` Tony Han Bao
2004-03-18 16:04     ` Eljay Love-Jensen

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).