bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10
       [not found] <20191120-145521.sv108124.86413@savannah.gnu.org>
@ 2019-11-20 23:49 ` Bernhard Voelker
  2019-11-21  2:15   ` Bruno Haible
  0 siblings, 1 reply; 8+ messages in thread
From: Bernhard Voelker @ 2019-11-20 23:49 UTC (permalink / raw)
  To: Martin Liška, Bernhard Voelker, bug-gnulib, bug-findutils

Follow-up Comment #1, bug #57277 (project findutils):

First of all, the fix for this should go into gnulib --> adding their ML.

Then, this test actually wants to verify the behavior of that
function when called with a NULL value (it should return NULL
and set errno to EINVAL).
Therefore, the test needs to suppress that specific sanitizer
error. I don't have a GCC 10, so does something like the
following work?


a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c
index 4ce06e46c..4e7d47c57 100644
--- a/tests/test-canonicalize-lgpl.c
+++ b/tests/test-canonicalize-lgpl.c
@@ -39,6 +39,9 @@ SIGNATURE_CHECK (canonicalize_file_name, char *, (const char
*));
 
 #define BASE "t-can-lgpl.tmp"
 
+/* Suppress -fsanitize=null error - seen on GCC 10 - for this test.  */
+extern char *canonicalize_file_name (const char *)
__attribute__((no_sanitize("null")));
+
 int
 main (void)
 {


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57277>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/



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

* [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10
  2019-11-20 23:49 ` [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10 Bernhard Voelker
@ 2019-11-21  2:15   ` Bruno Haible
  2019-11-21  9:37     ` Martin Liška
  0 siblings, 1 reply; 8+ messages in thread
From: Bruno Haible @ 2019-11-21  2:15 UTC (permalink / raw)
  To: Martin Liška, Bruno Haible, Bernhard Voelker, bug-gnulib,
	bug-findutils

Follow-up Comment #2, bug #57277 (project findutils):

Will this patch, that uses the same technique as canonicalize-lgpl.c, work? I
can't test it, because I don't have a GCC 10 installed.


diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c
index 4ce06e4..d9a9773 100644
--- a/tests/test-canonicalize-lgpl.c
+++ b/tests/test-canonicalize-lgpl.c
@@ -16,6 +16,10 @@
 
 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
 
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise
the
+   undefined-behaviour of GCC or clang may let the test with null_ptr crash. 
*/
+#define _GL_ARG_NONNULL(params)
+
 #include <config.h>
 
 #include <stdlib.h>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57277>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/



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

* [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10
  2019-11-21  2:15   ` Bruno Haible
@ 2019-11-21  9:37     ` Martin Liška
  2019-11-21 11:07       ` Bruno Haible
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Liška @ 2019-11-21  9:37 UTC (permalink / raw)
  To: Martin Liška, Bruno Haible, Bernhard Voelker, bug-gnulib,
	bug-findutils

Follow-up Comment #3, bug #57277 (project findutils):


[comment #1 comment #1:]
> First of all, the fix for this should go into gnulib --> adding their ML.
> 
> Then, this test actually wants to verify the behavior of that
> function when called with a NULL value (it should return NULL
> and set errno to EINVAL).
> Therefore, the test needs to suppress that specific sanitizer
> error.

No, it's not a sanitizer error, it's an error in gnulib code. One can't
decorate a function with nonnull attribute and then call the function
with NULL. Doing that, an optimizing compiler can do aggressive
optimizations.
So either the function canonicalize_file_name should accept (and handle
NULL),
then remove the nonnull attribute, or it can't and then one can't call
the function with NULL.
Thanks.

 I don't have a GCC 10, so does something like the
> following work?
> 
> 
> a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c
> index 4ce06e46c..4e7d47c57 100644
> --- a/tests/test-canonicalize-lgpl.c
> +++ b/tests/test-canonicalize-lgpl.c
> @@ -39,6 +39,9 @@ SIGNATURE_CHECK (canonicalize_file_name, char *, (const
char *));
>  
>  #define BASE "t-can-lgpl.tmp"
>  
> +/* Suppress -fsanitize=null error - seen on GCC 10 - for this test.  */
> +extern char *canonicalize_file_name (const char *)
__attribute__((no_sanitize("null")));
> +
>  int
>  main (void)
>  {
> 

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57277>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/



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

* [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10
  2019-11-21  9:37     ` Martin Liška
@ 2019-11-21 11:07       ` Bruno Haible
  2020-01-05 22:53         ` Bruno Haible
  0 siblings, 1 reply; 8+ messages in thread
From: Bruno Haible @ 2019-11-21 11:07 UTC (permalink / raw)
  To: Martin Liška, Bruno Haible, Bernhard Voelker, bug-gnulib,
	bug-findutils

Follow-up Comment #4, bug #57277 (project findutils):

> One can't decorate a function with nonnull attribute and then call the
function with NULL. Doing that, an optimizing compiler can do aggressive
optimizations.

__attribute__ __nonnull__ actually means two things:
1) The compiler may emit warnings when the function is invoked with null
arguments.
2) Unless the option -fno-delete-null-pointer-checks is specified, the
compiler may make optimizations, assuming that the function will not be
invoked with null arguments.

Source:
https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Common-Function-Attributes.html

> either ... or ...

Or you pass the option -fno-delete-null-pointer-checks when compiling the
code. (I'm not asking you to use this option. Only clarifying that there is a
third choice.)

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57277>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/



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

* [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10
  2019-11-21 11:07       ` Bruno Haible
@ 2020-01-05 22:53         ` Bruno Haible
  2020-01-06  0:46           ` Bernhard Voelker
  0 siblings, 1 reply; 8+ messages in thread
From: Bruno Haible @ 2020-01-05 22:53 UTC (permalink / raw)
  To: Martin Liška, Bruno Haible, Bernhard Voelker, bug-gnulib,
	bug-findutils

Follow-up Comment #5, bug #57277 (project findutils):

Fixed in gnulib today:
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=b7d7afe10ddf599452bd80b8a840c830cd474b09

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57277>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/



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

* [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10
  2020-01-05 22:53         ` Bruno Haible
@ 2020-01-06  0:46           ` Bernhard Voelker
  2020-01-06 13:06             ` Bernhard Voelker
  0 siblings, 1 reply; 8+ messages in thread
From: Bernhard Voelker @ 2020-01-06  0:46 UTC (permalink / raw)
  To: Bernhard Voelker, Martin Liška, Bruno Haible, bug-gnulib,
	bug-findutils

Update of bug #57277 (project findutils):

             Assigned to:                    None => berny                  


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57277>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/



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

* [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10
  2020-01-06  0:46           ` Bernhard Voelker
@ 2020-01-06 13:06             ` Bernhard Voelker
  2021-01-09 15:20               ` Bernhard Voelker
  0 siblings, 1 reply; 8+ messages in thread
From: Bernhard Voelker @ 2020-01-06 13:06 UTC (permalink / raw)
  To: Bernhard Voelker, Martin Liška, Bruno Haible, bug-gnulib,
	bug-findutils

Update of bug #57277 (project findutils):

                  Status:                    None => Fixed                  

    _______________________________________________________

Follow-up Comment #6:

Thanks, Bruno.

The attached picks up the gnulib patch by updating to latest.
Pushed at:
https://git.sv.gnu.org/cgit/findutils.git/commit/?id=28f11d689dc6




(file #48170)
    _______________________________________________________

Additional Item Attachment:

File name: 0001-maint-update-gnulib-to-latest.patch Size:0 KB
   
<https://savannah.gnu.org/file/0001-maint-update-gnulib-to-latest.patch?file_id=48170>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57277>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/



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

* [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10
  2020-01-06 13:06             ` Bernhard Voelker
@ 2021-01-09 15:20               ` Bernhard Voelker
  0 siblings, 0 replies; 8+ messages in thread
From: Bernhard Voelker @ 2021-01-09 15:20 UTC (permalink / raw)
  To: Bernhard Voelker, Martin Liška, Bruno Haible, bug-gnulib,
	bug-findutils

Update of bug #57277 (project findutils):

             Open/Closed:                    Open => Closed                 
                 Release:                    None => 4.7.0                  
           Fixed Release:                    None => 4.8.0                  


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57277>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/



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

end of thread, other threads:[~2021-01-09 15:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191120-145521.sv108124.86413@savannah.gnu.org>
2019-11-20 23:49 ` [bug #57277] FAIL: test-canonicalize-lgpl with GCC 10 Bernhard Voelker
2019-11-21  2:15   ` Bruno Haible
2019-11-21  9:37     ` Martin Liška
2019-11-21 11:07       ` Bruno Haible
2020-01-05 22:53         ` Bruno Haible
2020-01-06  0:46           ` Bernhard Voelker
2020-01-06 13:06             ` Bernhard Voelker
2021-01-09 15:20               ` Bernhard Voelker

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