ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:104925] [Ruby master Bug#18076] ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13
@ 2021-08-16  8:43 xtkoba (Tee KOBAYASHI)
  2021-08-17 17:39 ` [ruby-core:104957] " xtkoba (Tee KOBAYASHI)
  2021-10-13 15:42 ` [ruby-core:105631] " jeremyevans0 (Jeremy Evans)
  0 siblings, 2 replies; 3+ messages in thread
From: xtkoba (Tee KOBAYASHI) @ 2021-08-16  8:43 UTC (permalink / raw)
  To: ruby-core

Issue #18076 has been reported by xtkoba (Tee KOBAYASHI).

----------------------------------------
Bug #18076: ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13
https://bugs.ruby-lang.org/issues/18076

* Author: xtkoba (Tee KOBAYASHI)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-08-16T00:07:09Z master 4cc44bd819) [x86_64-linux]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```
compiling ../../../../ext/digest/md5/md5.c
../../../../ext/digest/md5/md5.c:228:17: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
    if (!((data - (const uint8_t *)0) & 3)) {
                ^ ~~~~~~~~~~~~~~~~~~
1 warning generated.
```



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:104957] [Ruby master Bug#18076] ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13
  2021-08-16  8:43 [ruby-core:104925] [Ruby master Bug#18076] ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13 xtkoba (Tee KOBAYASHI)
@ 2021-08-17 17:39 ` xtkoba (Tee KOBAYASHI)
  2021-10-13 15:42 ` [ruby-core:105631] " jeremyevans0 (Jeremy Evans)
  1 sibling, 0 replies; 3+ messages in thread
From: xtkoba (Tee KOBAYASHI) @ 2021-08-17 17:39 UTC (permalink / raw)
  To: ruby-core

Issue #18076 has been updated by xtkoba (Tee KOBAYASHI).


Proposed patch:

```diff
--- a/ext/digest/md5/md5.c
+++ b/ext/digest/md5/md5.c
@@ -225,7 +225,7 @@
     uint32_t xbuf[16];
     const uint32_t *X;
 
-    if (!((data - (const uint8_t *)0) & 3)) {
+    if (!(((uintptr_t)data) & 3)) {
 	/* data are properly aligned */
 	X = (const uint32_t *)data;
     } else {
```

----------------------------------------
Bug #18076: ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13
https://bugs.ruby-lang.org/issues/18076#change-93319

* Author: xtkoba (Tee KOBAYASHI)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-08-16T00:07:09Z master 4cc44bd819) [x86_64-linux]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```
compiling ../../../../ext/digest/md5/md5.c
../../../../ext/digest/md5/md5.c:228:17: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
    if (!((data - (const uint8_t *)0) & 3)) {
                ^ ~~~~~~~~~~~~~~~~~~
1 warning generated.
```



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:105631] [Ruby master Bug#18076] ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13
  2021-08-16  8:43 [ruby-core:104925] [Ruby master Bug#18076] ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13 xtkoba (Tee KOBAYASHI)
  2021-08-17 17:39 ` [ruby-core:104957] " xtkoba (Tee KOBAYASHI)
@ 2021-10-13 15:42 ` jeremyevans0 (Jeremy Evans)
  1 sibling, 0 replies; 3+ messages in thread
From: jeremyevans0 (Jeremy Evans) @ 2021-10-13 15:42 UTC (permalink / raw)
  To: ruby-core

Issue #18076 has been updated by jeremyevans0 (Jeremy Evans).


I submitted a pull request upstream to fix this: https://github.com/ruby/digest/pull/29

----------------------------------------
Bug #18076: ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13
https://bugs.ruby-lang.org/issues/18076#change-94121

* Author: xtkoba (Tee KOBAYASHI)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-08-16T00:07:09Z master 4cc44bd819) [x86_64-linux]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```
compiling ../../../../ext/digest/md5/md5.c
../../../../ext/digest/md5/md5.c:228:17: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
    if (!((data - (const uint8_t *)0) & 3)) {
                ^ ~~~~~~~~~~~~~~~~~~
1 warning generated.
```



-- 
https://bugs.ruby-lang.org/

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

end of thread, other threads:[~2021-10-13 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16  8:43 [ruby-core:104925] [Ruby master Bug#18076] ext/digest/md5/md5.c: `-Wnull-pointer-subtraction` warning by Clang 13 xtkoba (Tee KOBAYASHI)
2021-08-17 17:39 ` [ruby-core:104957] " xtkoba (Tee KOBAYASHI)
2021-10-13 15:42 ` [ruby-core:105631] " jeremyevans0 (Jeremy Evans)

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).