delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2020/12/10/16:43:05

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20161025;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to;
bh=GbMZdFTzQSuPqRKEscZXvjOZDwquiiQjpTLIAl8Tw68=;
b=Fwz5iF1h5CXz+iGHOPFMV6n0tu5cQqZiEinlhbduFydaACR7BNYK3iuiIEPC3pqpjo
w5nR6e0WIUS1FEXGrF9JKvdffXFmV3q/bWmK3qemCInRkQYpU1xUozaZCTzAAp1RT+ya
lgYM67E6p+tByZrLZfUAtlCZsq5Yb2ClBngYIjmaMrNkSU/5eaVXLhE/T/rmR+614kMv
8U57B3YkqqTZF87lvnK0poFr3Rick5QdMchDX12LzonlZXN1KiIBxlE9DR8waQrMp2G4
8q3E1KtaMTJ55XqF0G2ac5JXiEhmegfMUmLf1UDz/QdKYmt8yi80gv6c9mWg0xIa4dpT
Z2Nw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to;
bh=GbMZdFTzQSuPqRKEscZXvjOZDwquiiQjpTLIAl8Tw68=;
b=TAg9ertl9YU3PZCGFEuBwVFlQGMKgR3JWzrltDOKT9aXrAppdZkfNsHB4j9qah+G1V
kwnkAlePoip5iPgpDNmn7AQi62F5PHR2mhq0ZlWsfa15aDtoKic2hSJjNZtupCCOOT8h
yohMvBY4AI9ME1moPAL45CjlHtGtrbSHAjLG1LjEivfgiHCEM2IhIeN+hxjEUpfHawMM
1RApN3c4W4eTPodEnrrQ5y2B3YeHB95iWZ+cH9rBdkxu9q4NxCcNUmfFOVEYqVDMOSsK
JC4Ri71SlpS677iN+LfLu0tL7cua26GEo7E5G1YAFlMSH15xXHi/yW5f2LMaCYR2tIZo
RoVA==
X-Gm-Message-State: AOAM530sXnb0DbAWMvFqJSQEzAasBSI+KHxxbblcTQvvXM9s1Km0s2PV
VVxcQ2Ny8cmfVO4UsjM1HUHxTrm/8UjimjMosoR/DaK8
X-Google-Smtp-Source: ABdhPJx+wV4QYUu8O5x4ZBsxIA3EqQl8DRdaJRU7uChXxilLuv92VUAKLn8noV4Doau+bXXq104rc9BSD7z1fc1/8UA=
X-Received: by 2002:a05:6830:210a:: with SMTP id i10mr7441339otc.145.1607636372629;
Thu, 10 Dec 2020 13:39:32 -0800 (PST)
MIME-Version: 1.0
In-Reply-To: <5FD1FEA1.7010304@gmx.de>
References: <5FD1FEA1 DOT 7010304 AT gmx DOT de>
From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Date: Fri, 11 Dec 2020 00:39:32 +0300
Message-ID: <CAA2C=vB2FUmrC_iboB7Mp3Uu2hLoTxWB2ptEOkjc69Az3FZU1A@mail.gmail.com>
Subject: Re: Difficulties compiling libc from repository using gcc 10.N.0
To: djgpp AT delorie DOT com
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 12/10/20, Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via
djgpp AT delorie DOT com] <djgpp AT delorie DOT com> wrote:
> d:/djgpp/include/io.h: In function '_chmod':
> _chmod.c:28:14: warning: array subscript 1 is outside array bounds of
> 'int[1]' [-Warray-bounds]
>     28 |     r.x.cx = *(&func + 1);  /* Value to set */
>        |              ^~~~~~~~~~~~
> _chmod.c:14:34: note: while referencing 'func'
>     14 | _chmod(const char *filename, int func, ...)
>        |                              ~~~~^~~~
>
> The -Warray-bounds appears quite a lot due to our way to address
> neighborhood variables as can
> be seen in the example above.  May be some with some spare time can fix
> these occurencies.

As far as I can see, this particular case is intending this
using a nasty shortcut?

--- _chmod.c~
+++ _chmod.c
@@ -9,7 +9,8 @@
 #include <dpmi.h>
 #include <fcntl.h>
 #include <libc/dosio.h>
-
+#include <stdarg.h>
+
 int
 _chmod(const char *filename, int func, ...)
 {
@@ -25,7 +26,12 @@ _chmod(const char *filename, int func, .
     r.x.ax = 0x4300 + func;
   _put_path(filename);
   if (func == 1)
-    r.x.cx = *(&func + 1);		/* Value to set */
+  {
+    va_list ap;
+    va_start (ap, func);
+    r.x.cx = va_arg(ap, int);		/* Value to set */
+    va_end (ap);
+  }
   r.x.dx = __tb_offset;
   r.x.ds = __tb_segment;
   __dpmi_int(0x21, &r);

Correct?  Any others like this?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019