| delorie.com/archives/browse.cgi | search |
| DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 59ONcsUb3170948 |
| Authentication-Results: | delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com |
| Authentication-Results: | delorie.com; spf=pass smtp.mailfrom=cygwin.com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 delorie.com 59ONcsUb3170948 |
| Authentication-Results: | delorie.com; |
| dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=OAO7CNm7 | |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 1B48D3857B84 |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
| s=default; t=1761349133; | |
| bh=JbnjT5oTIJXtiY4pMg7Ro2xcQVlhS7fxx0CYTpP4rDM=; | |
| h=References:In-Reply-To:Date:Subject:To:Cc:List-Id: | |
| List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: | |
| From:Reply-To:From; | |
| b=OAO7CNm7X6YZzSbsthBVNvebkqR2tenmIJCWBbt+/4OI7iRRFB+O7MKb+Lwho5HpT | |
| cgEn77Ox2kAOR1tD+vV3sGxTgZ2Tv50NyXlA/wNqr7c1KswyttAnJgFxkLGYrHH2AX | |
| Y1DxRTgEcEvuJzk69KwlzGdhXrwjvhuFPX7tC9Xk= | |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org CC5963858D3C |
| ARC-Filter: | OpenARC Filter v1.0.0 sourceware.org CC5963858D3C |
| ARC-Seal: | i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761349069; cv=none; |
| b=gMg5hvNdbPnATf02KP0M1ksjcPE729w3kd7HbUHPGGWubriWtFKyDCvVKMXPQ+8XVWoEtGZxX6qCT7NrVeIha6r6LARklsqHqv//EzQWmOVgtnDPXoIkQ/Nu5tpPnKLKg3eTR4+lX6upBoehOQ1Cs9ev+nkD0o7JOelXFM2gqdQ= | |
| ARC-Message-Signature: | i=1; a=rsa-sha256; d=sourceware.org; s=key; |
| t=1761349069; c=relaxed/simple; | |
| bh=9iqQT+ETV7ihTWaP3hZu/CsqeOhkWYWN+/EGQa7xhR0=; | |
| h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; | |
| b=U3rKpuKXJ33xybx+nsy6Gf4KtGcCJoHc2YNSQ034Bax8Y3BIH67i8i5SebU3KmNz+x7H9W9vlPRFc5zVHSGmvjha9xKdkDt6Gu+wksaTbLg8Wpyp+jopJIYVT+mag7L/5CvD5Ku2sn0rdlkHugYkElXFJQ8dti6ba1UB5GTUegc= | |
| ARC-Authentication-Results: | i=1; server2.sourceware.org |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org CC5963858D3C |
| X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
| d=1e100.net; s=20230601; t=1761349067; x=1761953867; | |
| h=content-transfer-encoding:cc:to:subject:message-id:date:from | |
| :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc | |
| :subject:date:message-id:reply-to; | |
| bh=HsnSeAuVn07D6CtKiM0uM3RHswJjt71OZk496EZzArY=; | |
| b=P7EbY4gaQ7bCmPgGGUyThhJCJ8tQldvN8Ksf2aijySuygkVNn40R1RlR61etN/PTM+ | |
| +/MHBMBIgBplu+nUFxgnx8FgDzzVhx21we/OwNLVByEZP/wxg8QtYQdMeS2LW3gswSxf | |
| bohVev40tCZFRPh4Kpeejkr392NiV0YPVMjXD1ohA1w2z99XBQg3Lbg5vymlTRvz9Jw1 | |
| /y20yV+xo78FMqHMbFpzeSWFKCcQiiB4krsCPdKZ1qCKTGGrgIA+5IUMqOb43H++ZA46 | |
| WdcaOqmxh2QlJLUBvEuo50aoWZsJvq8B+YDeRAJGt1hRn0L630J6rQ9TTShcVs5U/uvg | |
| MY3w== | |
| X-Gm-Message-State: | AOJu0YwMTYgyuKiIKEVkxe7e7HBAYeR0w8WCUMhWP2kVSiblfnqbd4um |
| kj4jZCQZFwqg957evhynWo22nIAUDUmJE3pU7g5V5WadSddsLTo7M/dhyE7QSbdO0O9j+jorjVG | |
| AeeNOCKsZZT43qBDrhNOwkIPdVCx5cIWQnbhn | |
| X-Gm-Gg: | ASbGncszKoqD4rW9gwVnE70tLqcI/tdGEW7hlefYkthYAuZma3DA+7ET3FGaRvM3wQP |
| kC/UVWURE2cTFDBGhuoIyeIPmfwcoTeoipLGlo/RTbXb8P4Bk8vqCix0/qt1xhfPA3yWqa5E4aY | |
| yWWTVBYuUw5yRq+wtjsY32W0mi2O05TrQVcS7qaI1VGG1jmD6qKP3z/Xo61LLiBB/0R/Y7T0THe | |
| qH7zxX8yo++BPCwsdIJD5ygmM95NELCjLjqeupOBqnkIgtNmOcs16HsM86pSfVZFiNCLUOJQ2VU | |
| zRKUOA== | |
| X-Google-Smtp-Source: | AGHT+IH2uF6p03S61Yqrm14750J72U7nRm1sFWyc4rv2H6AbWeXvpX12JkTK6xYyoFu70Sv/KMT/jNQrB0rrHPBYLNw= |
| X-Received: | by 2002:a05:6000:3110:b0:3e4:64b0:a776 with SMTP id |
| ffacd0b85a97d-42990747c84mr3104252f8f.52.1761349066859; Fri, 24 Oct 2025 | |
| 16:37:46 -0700 (PDT) | |
| MIME-Version: | 1.0 |
| References: | <CAAHpriMb2CG9Tfv6S9ADc84-dwe1n2i+rxqoKDS_0Lwcdamghg AT mail DOT gmail DOT com> |
| In-Reply-To: | <CAAHpriMb2CG9Tfv6S9ADc84-dwe1n2i+rxqoKDS_0Lwcdamghg@mail.gmail.com> |
| Date: | Fri, 24 Oct 2025 16:37:35 -0700 |
| X-Gm-Features: | AWmQ_bnr_fSSTlrEwOxvbr_-c9yM9Cn0-o0eyeHPZON2m_ZQNPnlV9wh0aW5t4M |
| Message-ID: | <CAAHpriNeMeH2PYmhDW4QsrokJCAs-a5zmhGX=GjBY3cxCw8RsA@mail.gmail.com> |
| Subject: | Re: gcc/newlib bug: getline() should not be visible in conforming mode |
| To: | The Cygwin Mailing List <cygwin AT cygwin DOT com> |
| Cc: | Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com> |
| X-BeenThere: | cygwin AT cygwin DOT com |
| X-Mailman-Version: | 2.1.30 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| From: | Keith Thompson via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com> |
| Sender: | "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com> |
| X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id 59ONcsUb3170948 |
Stack Overflow user "pmor" has put together a C source file that
demonstrates a large number of similar problems, identifiers that
should not be visible in a strictly conforming compiler but are
visible with "gcc -std=c11 -pedantic".
A few of the symbols, namely gmtime_r, localtime_r, and timegm,
are declared in <time.h> in C23, but not in earlier editions
of the C standard. They should not be visible unless
you use "-std=c23" or "-std=gnu23" (the latter is the default
in more recent versions of gcc.
The program is here:
https://godbolt.org/z/Pr1obzYxx
And just in case that link isn't permanent, here's the code:
#include <assert.h>
#include <iso646.h>
#include <stdarg.h>
#include <string.h>
#include <complex.h>
#include <limits.h>
#if __STDC_NO_ATOMICS__ != 1
#include <stdatomic.h>
#endif
#include <tgmath.h>
#include <ctype.h>
#include <locale.h>
#include <stdbool.h>
#include <time.h>
#include <errno.h>
#include <math.h>
#include <stddef.h>
#include <uchar.h>
#include <fenv.h>
#include <setjmp.h>
#include <stdint.h>
#include <wchar.h>
#include <float.h>
#include <signal.h>
#include <stdio.h>
#include <wctype.h>
#include <inttypes.h>
#include <stdalign.h>
#include <stdlib.h>
typedef struct { int x; } T;
T BUS_ADRALN;
T BUS_ADRERR;
T BUS_OBJERR;
T CLD_CONTINUED;
T CLD_DUMPED;
T CLD_EXITED;
T CLD_KILLED;
T CLD_STOPPED;
T CLD_TRAPPED;
T FPE_FLTDIV;
T FPE_FLTINV;
T FPE_FLTOVF;
T FPE_FLTRES;
T FPE_FLTSUB;
T FPE_FLTUND;
T FPE_INTDIV;
T FPE_INTOVF;
T ILL_BADSTK;
T ILL_COPROC;
T ILL_ILLADR;
T ILL_ILLOPC;
T ILL_ILLOPN;
T ILL_ILLTRP;
T ILL_PRVOPC;
T ILL_PRVREG;
T SEGV_ACCERR;
T SEGV_MAPERR;
T SIGEV_NONE;
T SIGEV_SIGNAL;
T SIGEV_THREAD;
T SI_ASYNCIO;
T SI_KERNEL;
T SI_MESGQ;
T SI_QUEUE;
T SI_TIMER;
T SI_USER;
T addr_t;
T asctime_r;
T blkcnt_t;
T blksize_t;
T caddr_t;
T clock_getcpuclockid;
T clock_getenable_attr;
T clock_getres;
T clock_gettime;
T clock_nanosleep;
T clock_setenable_attr;
T clock_setres;
T clock_settime;
T clockid_t;
T cpu_set_t;
T ctime_r;
T daddr_t;
T dev_t;
T error_t;
struct flock { int x; };
T fpurge;
T fsblkcnt_t;
T fsfilcnt_t;
T gammaf;
T getdelim;
T getline;
T getprogname;
T gid_t;
T gmtime_r;
T gnu_dev_major;
T gnu_dev_makedev;
T gnu_dev_minor;
T id_t;
T infinity;
T infinityf;
T ino_t;
struct itimerspec { int x; };
T key_t;
T localtime_r;
T loff_t;
T memalign;
T mkdtemp;
T mode_t;
T nanosleep;
T nlink_t;
T off_t;
T pid_t;
T program_invocation_name;
T program_invocation_short_name;
T psignal;
T pthread_attr_t;
T pthread_barrier_t;
T pthread_barrierattr_t;
T pthread_cond_t;
T pthread_condattr_t;
T pthread_key_t;
T pthread_mutex_t;
T pthread_mutexattr_t;
T pthread_once_t;
T pthread_rwlock_t;
T pthread_rwlockattr_t;
T pthread_spinlock_t;
T pthread_t;
T register_t;
T sbintime_t;
T setprogname;
struct sigaltstack { int x; };
struct sigevent { int x; };
T sigevent_t;
T sigset_t;
struct sigval { int x; };
T sigval_t;
T stack_t;
T strtosigno;
T suseconds_t;
T sys_errlist;
T sys_nerr;
T timegm;
T timelocal;
T timer_create;
T timer_delete;
T timer_getoverrun;
T timer_gettime;
T timer_settime;
T timer_t;
T timespec_t;
T timestruc_t;
T u_int16_t;
T u_int32_t;
T u_int64_t;
T u_int8_t;
T uid_t;
T useconds_t;
T vm_object_t;
T vm_offset_t;
T vm_size_t;
T wcslcat;
T wcslcpy;
int main(void)
{
}
On Thu, Oct 23, 2025 at 8:28 PM Keith Thompson
<Keith DOT S DOT Thompson AT gmail DOT com> wrote:
>
> The "getline" function is specified by POSIX to be declared
> in <stdio.h>. It is not specified by the ISO C standard, so the
> identifier should be available for use in strictly conforming
> programs.
>
> $ cat getline_bug.c
> #include <stdio.h>
> int getline = 0;
> int main(void) {
> return getline;
> }
> $ gcc --version
> gcc (GCC) 16.0.0 20250907 (experimental)
> Copyright (C) 2025 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> $ gcc getline_bug.c -o getline_bug
> getline_bug.c:2:5: error: ‘getline’ redeclared as different kind of symbol
> 2 | int getline = 0;
> | ^~~~~~~
> In file included from /usr/include/stdio.h:85,
> from getline_bug.c:1:
> /usr/include/sys/stdio.h:35:9: note: previous declaration of ‘getline’ with type ‘ssize_t(char **, size_t *, FILE *)’ {aka ‘long int(char **, long unsigned int *, FILE *)’}
> 35 | ssize_t getline (char **, size_t *, FILE *);
> | ^~~~~~~
>
> $
>
> Stack Overflow user "pmor" reports the same problem with gcc 12.4.0.
>
> The problem is in newlib, winsup/cygwin/include/sys/stdio.h, line 35.
> I expect getdelim() to exhibit the same problem, but I haven't checked that.
>
> GNU libc's <stdio.h> avoids this problem by surrounding the
> declarations of getline() and getdelim() by an appropriate #ifdef.
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |