farnulfo / ai-contest

Automatically exported from code.google.com/p/ai-contest
0 stars 0 forks source link

C99 not supported, only gnu89. #180

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use C99 keywords in C bot.
2. Submit bot.
3. Enjoy build error.

What is the expected output? What do you see instead?

Given a valid C bot the expected output by the contest compiler is a feisty new 
bot. Instead, the server compiler is defaulting to gnu89--gcc's default--and 
will not build more modern C programs. 

What version of the product are you using? On what operating system?

I'm using gcc 4.5 on my personal Arch box with --std=gnu99 flipped on.

Please provide any additional information below.

Please see my post here: 
http://ai-contest.com/forum/viewtopic.php?f=18&t=700&start=0

I intend to submit a patch to fix this issue. 

Original issue reported on code.google.com by brian%tr...@gtempaccount.com on 29 Sep 2010 at 12:03

GoogleCodeExporter commented 8 years ago
My proposed fix is below. The will not impact any users preferring gnu89 as C99 
is strictly backwards compatible (and, by extension, gnu99 is backward 
compatible with gnu89).

Index: compile_anything.py
===================================================================
--- compile_anything.py (revision 380)
+++ compile_anything.py (working copy)
@@ -114,8 +114,8 @@
     sources = safeglob('*.c')
     for source in sources:
       object_file = source.replace(".c", "") + ".o"
-      system(['gcc', '-O3', '-funroll-loops', '-c', '-o', object_file, source])
-    system(['gcc', '-O2', '-o', 'MyBot'] + safeglob('*.o') + ['-lm'])
+      system(['gcc', '-std=gnu99' '-O3', '-funroll-loops', '-c', '-o', 
object_file, source])
+    system(['gcc', '-std=gnu99', '-O2', '-o', 'MyBot'] + safeglob('*.o') + 
['-lm'])
     check_path('MyBot')
   if language == "Go":
     nukeglob('*.6')

Original comment by brian%tr...@gtempaccount.com on 29 Sep 2010 at 12:10

GoogleCodeExporter commented 8 years ago
According to 
http://gcc.gnu.org/onlinedocs/gcc-4.5.1/gcc/C-Dialect-Options.html, the default 
is gnu89, which supports some C99 features, while gnu99 is a dialect of C99.

What features of gnu99 minus c99 are you using?

Original comment by jokeserver on 2 Oct 2010 at 2:09

GoogleCodeExporter commented 8 years ago
It appears that C compilation doesn't work at all, even for ANSI C.  Please see 
issue 187.

Original comment by jklan...@gmail.com on 4 Oct 2010 at 8:07

GoogleCodeExporter commented 8 years ago
Apparently I can't email my comments. Apologies.

On Sat, Oct 02, 2010 at 02:10:19AM +0000, ai-contest@googlecode.com wrote:
>
> Comment #2 on issue 180 by jokeserver: C99 not supported, only gnu89.
> http://code.google.com/p/ai-contest/issues/detail?id=180
>
> According to
> http://gcc.gnu.org/onlinedocs/gcc-4.5.1/gcc/C-Dialect-Options.html,
> the default is gnu89, which supports some C99 features, while gnu99
> is a dialect of C99.
>
> What features of gnu99 minus c99 are you using?

Yes, gnu99 is a dialect of C99, meaning it is C99 with some added GNU
extensions.  gnu89 supports rather very little of C99; as I noted I wish to
make use of the 'restrict' keyword. The features of C99 that gnu89 backports
are mostly to do with pointer aliasing, if memory serves, and no keywords.

C99 (and by extension gnu99) are perfectly backward compatible with gnu89/C90.

Original comment by brian%tr...@gtempaccount.com on 4 Oct 2010 at 2:06

GoogleCodeExporter commented 8 years ago
According to your post, the message you received was: "There was an 
unspecificed Error. (compile_function returned None.)"

This is the error covered by Issue 187. In fact, with the absence of any other 
error message, I will bet that gcc compiled your entry successfully, but the 
bug in Issue 187 prevented your submission from being recognized as successful.

A fix for that issue is in the pipeline. I'd like to see whether that works 
before changing compiler flags.

Original comment by jokeserver on 8 Oct 2010 at 5:31

GoogleCodeExporter commented 8 years ago
Fair enough.

Original comment by brian%tr...@gtempaccount.com on 9 Oct 2010 at 12:50

GoogleCodeExporter commented 8 years ago
The fix is now in trunk. Can you resubmit and let me know whether it works?

Original comment by jokeserver on 12 Oct 2010 at 4:26

GoogleCodeExporter commented 8 years ago

Original comment by jokeserver on 18 Nov 2010 at 7:09