Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#45309 - Header file stdlib.h should provide prototype for random() even with "std=c99".

Attached to Project: Arch Linux
Opened by Norman Hardy (NormHardy) - Friday, 12 June 2015, 21:01 GMT
Last edited by Gerardo Exequiel Pozzi (djgera) - Friday, 12 June 2015, 23:49 GMT
Task Type Bug Report
Category System
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
File i.c:
#include <stdlib.h>
int main(){return(random());}
// gcc i.c -std=c99

------------------
compilation yields:
i.c:2:1: warning: implicit declaration of function ‘random’ [-Wimplicit-function-declaration]

Additional info:
Fails on the two Linux systems where I tested it.

gcc version 4.6.4 (GCC)
gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)

-bash-4.1$ openssl md5 /usr/include/stdlib.h
MD5(/usr/include/stdlib.h)= bb6d8d92d80fc6b84f9a46747bdb2169

For what it is worth:
gcc requires -std=c99 for construct beginning "for(int j =0; ...)"
clang does not.
Test fails to fail without -std=c99

Steps to reproduce:

Compile file i.c thus:
gcc i.c -std=c99


This task depends upon

Closed by  Gerardo Exequiel Pozzi (djgera)
Friday, 12 June 2015, 23:49 GMT
Reason for closing:  Not a bug
Additional comments about closing:  random(3) is not a C99 std. Is a POSIX extension. Use -std=gnu99

Loading...