unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* warning: unsequenced modification and access to 'sa_avail'
@ 2021-03-27 16:05 Jeffrey Walton
  2021-03-27 17:01 ` Philipp
  0 siblings, 1 reply; 5+ messages in thread
From: Jeffrey Walton @ 2021-03-27 16:05 UTC (permalink / raw)
  To: Emacs developers

Hi Everyone,

I'm building Emacs 27.2 on the Apple M1 machine. I think the compiler
is complaining about undefined behavior:

    sa_avail -= (size), alloca (size)

I think it is equivalent to something like this:

    data[i] = data[i++];

/usr/bin/clang -c -I/usr/local/include -DNDEBUG -Demacs  -I. -I.
-I../lib -I../lib         -I/usr/local/include/libxml2
-I/usr/local/include              -MMD -MF deps/doc.d -MP
-I/usr/local/include -I/usr/local/include/p11-kit-1    -Wno-switch
-Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes
-Wno-initializer-overrides -Wno-tautological-compare
-Wno-tautological-constant-out-of-range-compare -g2 -O2 -fno-common
-arch arm64 -fPIC -pthread  doc.c
/usr/bin/clang -c -I/usr/local/include -DNDEBUG -Demacs  -I. -I.
-I../lib -I../lib         -I/usr/local/include/libxml2
-I/usr/local/include              -MMD -MF deps/editfns.d -MP
-I/usr/local/include -I/usr/local/include/p11-kit-1    -Wno-switch
-Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes
-Wno-initializer-overrides -Wno-tautological-compare
-Wno-tautological-constant-out-of-range-compare -g2 -O2 -fno-common
-arch arm64 -fPIC -pthread  editfns.c
editfns.c:2063:18: warning: unsequenced modification and access to 'sa_avail'
      [-Wunsequenced]
    .deletions = SAFE_ALLOCA (del_bytes),
                 ^
./lisp.h:4817:9: note: expanded from macro 'SAFE_ALLOCA'
                           ? AVAIL_ALLOCA (size)                        \
                             ^
./lisp.h:4812:38: note: expanded from macro 'AVAIL_ALLOCA'
#define AVAIL_ALLOCA(size) (sa_avail -= (size), alloca (size))
                                     ^

Jeff



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: warning: unsequenced modification and access to 'sa_avail'
  2021-03-27 16:05 warning: unsequenced modification and access to 'sa_avail' Jeffrey Walton
@ 2021-03-27 17:01 ` Philipp
  2021-03-27 17:10   ` Jeffrey Walton
  0 siblings, 1 reply; 5+ messages in thread
From: Philipp @ 2021-03-27 17:01 UTC (permalink / raw)
  To: noloader; +Cc: Emacs developers



> Am 27.03.2021 um 17:05 schrieb Jeffrey Walton <noloader@gmail.com>:
> 
> Hi Everyone,
> 
> I'm building Emacs 27.2 on the Apple M1 machine. I think the compiler
> is complaining about undefined behavior:
> 
>    sa_avail -= (size), alloca (size)
> 
> I think it is equivalent to something like this:
> 
>    data[i] = data[i++];
> 
> /usr/bin/clang -c -I/usr/local/include -DNDEBUG -Demacs  -I. -I.
> -I../lib -I../lib         -I/usr/local/include/libxml2
> -I/usr/local/include              -MMD -MF deps/doc.d -MP
> -I/usr/local/include -I/usr/local/include/p11-kit-1    -Wno-switch
> -Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes
> -Wno-initializer-overrides -Wno-tautological-compare
> -Wno-tautological-constant-out-of-range-compare -g2 -O2 -fno-common
> -arch arm64 -fPIC -pthread  doc.c
> /usr/bin/clang -c -I/usr/local/include -DNDEBUG -Demacs  -I. -I.
> -I../lib -I../lib         -I/usr/local/include/libxml2
> -I/usr/local/include              -MMD -MF deps/editfns.d -MP
> -I/usr/local/include -I/usr/local/include/p11-kit-1    -Wno-switch
> -Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes
> -Wno-initializer-overrides -Wno-tautological-compare
> -Wno-tautological-constant-out-of-range-compare -g2 -O2 -fno-common
> -arch arm64 -fPIC -pthread  editfns.c
> editfns.c:2063:18: warning: unsequenced modification and access to 'sa_avail'
>      [-Wunsequenced]
>    .deletions = SAFE_ALLOCA (del_bytes),
>                 ^
> ./lisp.h:4817:9: note: expanded from macro 'SAFE_ALLOCA'
>                           ? AVAIL_ALLOCA (size)                        \
>                             ^
> ./lisp.h:4812:38: note: expanded from macro 'AVAIL_ALLOCA'
> #define AVAIL_ALLOCA(size) (sa_avail -= (size), alloca (size))
>                                     ^
> 

This has already been fixed by commit 6a4ed891d84b1ca1e4d68a6de9dd374f1fadd971, which hasn't made it into the release though.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: warning: unsequenced modification and access to 'sa_avail'
  2021-03-27 17:01 ` Philipp
@ 2021-03-27 17:10   ` Jeffrey Walton
  2021-03-27 17:17     ` Philipp
  2021-03-27 19:05     ` Andreas Schwab
  0 siblings, 2 replies; 5+ messages in thread
From: Jeffrey Walton @ 2021-03-27 17:10 UTC (permalink / raw)
  To: Philipp; +Cc: Emacs developers

On Sat, Mar 27, 2021 at 1:01 PM Philipp <p.stephani2@gmail.com> wrote:
>
> > Am 27.03.2021 um 17:05 schrieb Jeffrey Walton <noloader@gmail.com>:
> >
> > I'm building Emacs 27.2 on the Apple M1 machine. I think the compiler
> > is complaining about undefined behavior:
> >
> >    sa_avail -= (size), alloca (size)
> >
> > I think it is equivalent to something like this:
> >
> >    data[i] = data[i++];
> >
> > /usr/bin/clang -c -I/usr/local/include -DNDEBUG -Demacs  -I. -I.
> > -I../lib -I../lib         -I/usr/local/include/libxml2
> > -I/usr/local/include              -MMD -MF deps/doc.d -MP
> > -I/usr/local/include -I/usr/local/include/p11-kit-1    -Wno-switch
> > -Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes
> > -Wno-initializer-overrides -Wno-tautological-compare
> > -Wno-tautological-constant-out-of-range-compare -g2 -O2 -fno-common
> > -arch arm64 -fPIC -pthread  doc.c
> > /usr/bin/clang -c -I/usr/local/include -DNDEBUG -Demacs  -I. -I.
> > -I../lib -I../lib         -I/usr/local/include/libxml2
> > -I/usr/local/include              -MMD -MF deps/editfns.d -MP
> > -I/usr/local/include -I/usr/local/include/p11-kit-1    -Wno-switch
> > -Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes
> > -Wno-initializer-overrides -Wno-tautological-compare
> > -Wno-tautological-constant-out-of-range-compare -g2 -O2 -fno-common
> > -arch arm64 -fPIC -pthread  editfns.c
> > editfns.c:2063:18: warning: unsequenced modification and access to 'sa_avail'
> >      [-Wunsequenced]
> >    .deletions = SAFE_ALLOCA (del_bytes),
> >                 ^
> > ./lisp.h:4817:9: note: expanded from macro 'SAFE_ALLOCA'
> >                           ? AVAIL_ALLOCA (size)                        \
> >                             ^
> > ./lisp.h:4812:38: note: expanded from macro 'AVAIL_ALLOCA'
> > #define AVAIL_ALLOCA(size) (sa_avail -= (size), alloca (size))
> >                                     ^
> >
>
> This has already been fixed by commit 6a4ed891d84b1ca1e4d68a6de9dd374f1fadd971, which hasn't made it into the release though.

Thanks Philipp.

Forgive my ignorance... Where is that commit? I can't seem to find it
at https://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-27.
Searching the logs for your name, and searching for
6a4ed891d84b1ca1e4d68a6de9dd374f1fadd971 (and 6a4ed891d84b) returns 0
hits.

Jeff



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: warning: unsequenced modification and access to 'sa_avail'
  2021-03-27 17:10   ` Jeffrey Walton
@ 2021-03-27 17:17     ` Philipp
  2021-03-27 19:05     ` Andreas Schwab
  1 sibling, 0 replies; 5+ messages in thread
From: Philipp @ 2021-03-27 17:17 UTC (permalink / raw)
  To: noloader; +Cc: Emacs developers



> Am 27.03.2021 um 18:10 schrieb Jeffrey Walton <noloader@gmail.com>:
> 
> On Sat, Mar 27, 2021 at 1:01 PM Philipp <p.stephani2@gmail.com> wrote:
>> 
>>> Am 27.03.2021 um 17:05 schrieb Jeffrey Walton <noloader@gmail.com>:
>>> 
>>> I'm building Emacs 27.2 on the Apple M1 machine. I think the compiler
>>> is complaining about undefined behavior:
>>> 
>>>   sa_avail -= (size), alloca (size)
>>> 
>>> I think it is equivalent to something like this:
>>> 
>>>   data[i] = data[i++];
>>> 
>>> /usr/bin/clang -c -I/usr/local/include -DNDEBUG -Demacs  -I. -I.
>>> -I../lib -I../lib         -I/usr/local/include/libxml2
>>> -I/usr/local/include              -MMD -MF deps/doc.d -MP
>>> -I/usr/local/include -I/usr/local/include/p11-kit-1    -Wno-switch
>>> -Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes
>>> -Wno-initializer-overrides -Wno-tautological-compare
>>> -Wno-tautological-constant-out-of-range-compare -g2 -O2 -fno-common
>>> -arch arm64 -fPIC -pthread  doc.c
>>> /usr/bin/clang -c -I/usr/local/include -DNDEBUG -Demacs  -I. -I.
>>> -I../lib -I../lib         -I/usr/local/include/libxml2
>>> -I/usr/local/include              -MMD -MF deps/editfns.d -MP
>>> -I/usr/local/include -I/usr/local/include/p11-kit-1    -Wno-switch
>>> -Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-attributes
>>> -Wno-initializer-overrides -Wno-tautological-compare
>>> -Wno-tautological-constant-out-of-range-compare -g2 -O2 -fno-common
>>> -arch arm64 -fPIC -pthread  editfns.c
>>> editfns.c:2063:18: warning: unsequenced modification and access to 'sa_avail'
>>>     [-Wunsequenced]
>>>   .deletions = SAFE_ALLOCA (del_bytes),
>>>                ^
>>> ./lisp.h:4817:9: note: expanded from macro 'SAFE_ALLOCA'
>>>                          ? AVAIL_ALLOCA (size)                        \
>>>                            ^
>>> ./lisp.h:4812:38: note: expanded from macro 'AVAIL_ALLOCA'
>>> #define AVAIL_ALLOCA(size) (sa_avail -= (size), alloca (size))
>>>                                    ^
>>> 
>> 
>> This has already been fixed by commit 6a4ed891d84b1ca1e4d68a6de9dd374f1fadd971, which hasn't made it into the release though.
> 
> Thanks Philipp.
> 
> Forgive my ignorance... Where is that commit? I can't seem to find it
> at https://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-27.
> Searching the logs for your name, and searching for
> 6a4ed891d84b1ca1e4d68a6de9dd374f1fadd971 (and 6a4ed891d84b) returns 0
> hits.
> 

Try 'git show 6a4ed891d84b1ca1e4d68a6de9dd374f1fadd971'.  Right now it's the ninth-most recent commit on the emacs-27 branch.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: warning: unsequenced modification and access to 'sa_avail'
  2021-03-27 17:10   ` Jeffrey Walton
  2021-03-27 17:17     ` Philipp
@ 2021-03-27 19:05     ` Andreas Schwab
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2021-03-27 19:05 UTC (permalink / raw)
  To: Jeffrey Walton; +Cc: Philipp, Emacs developers

On Mär 27 2021, Jeffrey Walton wrote:

> Forgive my ignorance... Where is that commit? I can't seem to find it
> at https://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-27.

https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=6a4ed891d84b1ca1e4d68a6de9dd374f1fadd971

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-27 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 16:05 warning: unsequenced modification and access to 'sa_avail' Jeffrey Walton
2021-03-27 17:01 ` Philipp
2021-03-27 17:10   ` Jeffrey Walton
2021-03-27 17:17     ` Philipp
2021-03-27 19:05     ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).