public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
@ 2003-02-19 17:06 Wolfgang Bangerth
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Bangerth @ 2003-02-19 17:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/2776; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Mirsad Todorovac <mtodorov@alu.hr>
Cc: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Subject: Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
Date: Wed, 19 Feb 2003 10:57:17 -0600 (CST)

 > I apologize if I was wasting your precious timewith this as it now seems
 > not so important issue, but I wasted so much time resolving it that I
 > thought it was important to be resolved, or at least known issue.
 >
 > Thank you for your time. Mirsad
 
 No problem. This is just one of the cases where what you wanted would 
 require the compiler to second-guess what was your original intention. 
 Your example boiled down to
   char *p = hip hop step;
 The problem was the missing quotes (which the compiler can't know, since 
 the three tokens came from the preprocessor, and there might be many 
 possible interpretations of what the orginal intent was:
   char *p = "hip hop step";
   char *p = hip+hop+step;     // hip=char*, hop,step=int
   char *p = hiphopstep;       // hiphopstep=char*
 etc. There is just not something sensible the compiler can say here, 
 except for "parse error" or so.
 
 With respect to the fact that the error message was totally 
 incomprehensible: most experienced programmers know that if something is 
 _really_ incomprehensible, the look at the preprocessed sources. I'd say 
 this is for exactly the same kind of experience you just made :-(
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 


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

* Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
@ 2003-02-19 18:56 Mirsad Todorovac
  0 siblings, 0 replies; 6+ messages in thread
From: Mirsad Todorovac @ 2003-02-19 18:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/2776; it has been noted by GNATS.

From: Mirsad Todorovac <mtodorov@alu.hr>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Subject: Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
Date: Wed, 19 Feb 2003 19:48:38 +0100 (CET)

 On Wed, 19 Feb 2003, Wolfgang Bangerth wrote:
 
 >
 > > I apologize if I was wasting your precious timewith this as it now seems
 > > not so important issue, but I wasted so much time resolving it that I
 > > thought it was important to be resolved, or at least known issue.
 > >
 > > Thank you for your time. Mirsad
 >
 > No problem. This is just one of the cases where what you wanted would
 > require the compiler to second-guess what was your original intention.
 > Your example boiled down to
 >   char *p = hip hop step;
 > The problem was the missing quotes (which the compiler can't know, since
 > the three tokens came from the preprocessor, and there might be many
 > possible interpretations of what the orginal intent was:
 >   char *p = "hip hop step";
 >   char *p = hip+hop+step;     // hip=char*, hop,step=int
 >   char *p = hiphopstep;       // hiphopstep=char*
 > etc. There is just not something sensible the compiler can say here,
 > except for "parse error" or so.
 >
 > With respect to the fact that the error message was totally
 > incomprehensible: most experienced programmers know that if something is
 > _really_ incomprehensible, the look at the preprocessed sources. I'd say
 > this is for exactly the same kind of experience you just made :-(
 
 Thank you for this explanation, which makes things much clearer. I
 understand that AI is probably not a good thing to install in a compiler,
 since a compiler has to be small and reliable, hasn't it? :-))
 
 Be blessed,
 M.
 
 


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

* Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
@ 2003-02-19 16:56 Mirsad Todorovac
  0 siblings, 0 replies; 6+ messages in thread
From: Mirsad Todorovac @ 2003-02-19 16:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/2776; it has been noted by GNATS.

From: Mirsad Todorovac <mtodorov@alu.hr>
To: bangerth@dealii.org, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>,
   <mtodorov@alu.hr>, <nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
Date: Wed, 19 Feb 2003 17:45:08 +0100 (CET)

 On 19 Feb 2003 bangerth@dealii.org wrote:
 
 > Synopsis: Wrong (misleading) error message in gcc 2.95.3
 >
 > State-Changed-From-To: analyzed->closed
 > State-Changed-By: bangerth
 > State-Changed-When: Wed Feb 19 14:27:03 2003
 > State-Changed-Why:
 >     I guess, Steven is right. There's no value in keeping this
 >     one open.
 >
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=2776
 
 I apologize if I was wasting your precious timewith this as it now seems
 not so important issue, but I wasted so much time resolving it that I
 thought it was important to be resolved, or at least known issue.
 
 Thank you for your time. Mirsad
 
 


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

* Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
@ 2003-02-19 14:27 bangerth
  0 siblings, 0 replies; 6+ messages in thread
From: bangerth @ 2003-02-19 14:27 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, mtodorov, nobody

Synopsis: Wrong (misleading) error message in gcc 2.95.3

State-Changed-From-To: analyzed->closed
State-Changed-By: bangerth
State-Changed-When: Wed Feb 19 14:27:03 2003
State-Changed-Why:
    I guess, Steven is right. There's no value in keeping this
    one open.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=2776


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

* Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
@ 2003-02-19 14:06 Steven Bosscher
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Bosscher @ 2003-02-19 14:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/2776; it has been noted by GNATS.

From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,
	gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: c/2776: Wrong (misleading) error message in gcc 2.95.3
Date: Wed, 19 Feb 2003 15:01:57 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=2776
 
 This is the kind of issue that will probably never be fixed (if you 
 would consider this a bug at all).  Can the PR be closed?
 
 


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

* c/2776: Wrong (misleading) error message in gcc 2.95.3
@ 2001-05-08 10:56 mtodorov
  0 siblings, 0 replies; 6+ messages in thread
From: mtodorov @ 2001-05-08 10:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2776
>Category:       c
>Synopsis:       Wrong (misleading) error message in gcc 2.95.3
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue May 08 10:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mirsad Todorovac
>Release:        gcc 2.95.3
>Organization:
>Environment:
alpha-dec-osf4.0b
gcc-2.95.3
gmake 3.79
tcsh 6.10.00

>Description:
When the following code was compiled:

 99        if(_GrFontFileInfo.npath < 0) {
100            char *fPath = getenv("GRXFONT");
101 #ifdef GRX_DEFAULT_FONT_PATH
102             if (!fPath) fPath = GRX_DEFAULT_FONT_PATH;
103 #endif
104            GrSetFontPath(fPath);
105        }


gcc 2.95.3 returned following error message:

text/loadfont.c:102: parse error before `/'
text/loadfont.c:102: warning: empty body in an if-statement

Gcc was invoked by gmake with following options:
gcc -c -O6 -Wall -W -Wshadow -Wpointer-arith \
-Wbad-function-cast -Wcast-align -Wconversion \
-Wmissing-prototypes -Wnested-externs -Wstrict-prototypes \
-DGRX_DEFAULT_FONT_PATH="/usr/local/lib/grx/fonts" \
-DSMALL_STACK -fomit-frame-pointer -D__XWIN__ -I. \
-I./include -I../include -I/usr/X11R6/include \
-I../addons/print -I../addons/bmp text/loadfont.c \
-o text/loadfont.o

I couldn't decrypt what it meant until I tried gcc -E
(running preprocessor to see what the compiler is really
looking at) and I carefully found the line 102 of
loadfont.c after header inclusion. I've found this:

 99        if(_GrFontFileInfo.npath < 0) {
100            char *fPath = getenv("GRXFONT");
101
102         if (!fPath) fPath = /usr/local/lib/grx/fonts ;
103
104            GrSetFontPath(fPath);
105        }

Now it's obvious what the error is: the path was left
without quotes, although in Makefile it has quotes (the
shell probably stripped them).

But from error message "empty body in an if-statement" it
cannot be seen.

The right error message should be "invalid expression"
or something like that. I understand that gcc can't
"see" that this is actually an error in macro definition
of GRX_DEFAULT_FONT_PATH.

Changing definition of GRX_DEFAULT_FONT_PATH to
\"/usr/local/lib/grx/fonts\" resolved the problem with
GRX build (as for now), but misleading error message in
gcc remains ...

Mirsad Todorovac
>How-To-Repeat:
cat > repeat.c
int main(int argc, char* argv[])
{
        char *fPath = 0;

        if (!fPath) fPath = /usr/local/share/grx/fonts ;
}
^D

gcc -c -O6 -Wall -W -Wshadow -Wpointer-arith \
-Wbad-function-cast -Wcast-align -Wconversion \
-Wmissing-prototypes -Wnested-externs -Wstrict-prototypes \
-DGRX_DEFAULT_FONT_PATH=\"/usr/local/lib/grx/fonts\" \
-DSMALL_STACK -fomit-frame-pointer repeat.c

>Fix:
Try to give a correct error message, like
"bad expression: have you forgot quotes on '/usr/local/lib/grx/fonts'?"
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-02-19 18:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 17:06 c/2776: Wrong (misleading) error message in gcc 2.95.3 Wolfgang Bangerth
  -- strict thread matches above, loose matches on Subject: below --
2003-02-19 18:56 Mirsad Todorovac
2003-02-19 16:56 Mirsad Todorovac
2003-02-19 14:27 bangerth
2003-02-19 14:06 Steven Bosscher
2001-05-08 10:56 mtodorov

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