emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#14572: closed (Goto Label Bug)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#14572: closed (Goto Label Bug)
Date: Fri, 07 Jun 2013 21:18:02 +0000

Your message dated Fri, 07 Jun 2013 17:16:32 -0400
with message-id <address@hidden>
and subject line Re: bug#14572: Goto Label Bug
has caused the debbugs.gnu.org bug report #14572,
regarding Goto Label Bug
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
14572: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14572
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Goto Label Bug Date: Fri, 7 Jun 2013 08:50:38 -0400
If a goto label is followed by an SCM variable declaration, a compilation error 
will result.  I've written up this piece of code that demonstrates the behavior 
and how to work around it, available here:

https://gist.github.com/shanecelis/5728982

-Shane


--- End Message ---
--- Begin Message --- Subject: Re: bug#14572: Goto Label Bug Date: Fri, 07 Jun 2013 17:16:32 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Shane Celis <address@hidden> writes:

> If a goto label is followed by an SCM variable declaration, a
> compilation error will result.  I've written up this piece of code
> that demonstrates the behavior and how to work around it, available
> here:
>
> https://gist.github.com/shanecelis/5728982

In the future, please send the relevant information as attachments, so
that it's recorded in our bug tracking system.  For posterity, here it
is:

--8<---------------cut here---------------start------------->8---
/*
   This file demonstrates a bug with C goto labels and Guile.

$ gcc `pkg-config guile-2.0 --cflags --libs` goto_label_bug.c -o goto_label_bug
goto_label_bug.c: In function 'main':
goto_label_bug.c:10: error: expected expression before 'SCM'

$ gcc `pkg-config guile-2.0 --cflags --libs` goto_label_bug.c -o goto_label_bug 
-D INSERT_NOOP
$ # No problem.

Shane Celis

 */

#include <libguile.h>

int main(int argc, char *argv[]) {
  scm_init_guile();
  goto end;

end:
#ifdef INSERT_NOOP
  ;                             /* No error with dummy statement. */
#endif
  SCM dummy = SCM_BOOL_T;       /* Causes error. */

  return 0;
}
--8<---------------cut here---------------end--------------->8---

This is unrelated to Guile.  The same problem happens with GCC 4.7 if
you make the following substitutions:

  libguile.h       --> stdio.h
  scm_init_guile() --> printf ("Test\n");
  SCM              --> int
  SCM_BOOL_T       --> 0

However, in that case the error message is more helpful:

  error: a label can only be part of a statement and a declaration is not a 
statement

Indeed, C99 section 6.8.1 specifies that labels may only precede
statements.

    Regards,
      Mark


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]