public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111625] New: valgrind error with ./gcc.dg/bitint-8.c
@ 2023-09-28 10:26 dcb314 at hotmail dot com
  2023-09-28 10:38 ` [Bug c/111625] " dcb314 at hotmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-28 10:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111625

            Bug ID: 111625
           Summary: valgrind error with ./gcc.dg/bitint-8.c
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For the file from the testsuite, recent gcc trunk, compiled with valgrind,
does this:

$ ~/gcc/results.20230927.valgrind/bin/gcc -c -w ./gcc.dg/bitint-8.c
==196002== Conditional jump or move depends on uninitialised value(s)
==196002==    at 0xF6EF71: wide_int_to_tree_1(tree_node*,
generic_wide_int<wide_int_ref_storage<false, true> > const&) (tree.cc:1748)
==196002==    by 0xF6F4CA: wide_int_to_tree (tree.cc:1869)
==196002==    by 0xF6F4CA: build_int_cst(tree_node*, poly_int<1u, long>)
(tree.cc:1508)
==196002==    by 0x1924027: (anonymous
namespace)::bitint_large_huge::lower_muldiv_stmt(tree_node*, gimple*)
(gimple-lower-bitint.cc:3335)

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

* [Bug c/111625] valgrind error with ./gcc.dg/bitint-8.c
  2023-09-28 10:26 [Bug c/111625] New: valgrind error with ./gcc.dg/bitint-8.c dcb314 at hotmail dot com
@ 2023-09-28 10:38 ` dcb314 at hotmail dot com
  2023-09-29 14:42 ` [Bug middle-end/111625] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-28 10:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111625

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
It appears to go wrong sometime from 20230830 and 20230907:

testsuite $ ~/gcc/results.20230830.valgrind/bin/gcc -c -w gcc.dg/bitint-8.c 
--202909-- WARNING: Serious error when reading debug info
--202909-- When reading debug info from /usr/bin/as:
--202909-- get_Form_contents: DW_FORM_GNU_strp_alt used, but no alternate
.debug_str
--202909-- WARNING: Serious error when reading debug info
--202909-- When reading debug info from /usr/lib64/libbfd-2.39-9.fc38.so:
--202909-- get_Form_contents: DW_FORM_GNU_strp_alt used, but no alternate
.debug_str
testsuite $ ~/gcc/results.20230907.valgrind/bin/gcc -c -w gcc.dg/bitint-8.c 
==203039== Conditional jump or move depends on uninitialised value(s)
==203039==    at 0x110BBA1: wide_int_to_tree_1(tree_node*,
generic_wide_int<wide_int_ref_storage<false, true> > const&) (tree.cc:1748)
==203039==    by 0x110C0FA: wide_int_to_tree (tree.cc:1869)
==203039==    by 0x110C0FA: build_int_cst(tree_node*, poly_int<1u, long>)
(tree.cc:1508)

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

* [Bug middle-end/111625] valgrind error with ./gcc.dg/bitint-8.c
  2023-09-28 10:26 [Bug c/111625] New: valgrind error with ./gcc.dg/bitint-8.c dcb314 at hotmail dot com
  2023-09-28 10:38 ` [Bug c/111625] " dcb314 at hotmail dot com
@ 2023-09-29 14:42 ` jakub at gcc dot gnu.org
  2023-09-29 14:45 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-09-29 14:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111625

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |14.0
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2023-09-29
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Target Milestone|---                         |14.0

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

* [Bug middle-end/111625] valgrind error with ./gcc.dg/bitint-8.c
  2023-09-28 10:26 [Bug c/111625] New: valgrind error with ./gcc.dg/bitint-8.c dcb314 at hotmail dot com
  2023-09-28 10:38 ` [Bug c/111625] " dcb314 at hotmail dot com
  2023-09-29 14:42 ` [Bug middle-end/111625] " jakub at gcc dot gnu.org
@ 2023-09-29 14:45 ` jakub at gcc dot gnu.org
  2023-09-30  9:34 ` cvs-commit at gcc dot gnu.org
  2023-09-30 10:08 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-09-29 14:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111625

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 56016
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56016&action=edit
gcc14-pr111625.patch

Untested fix.

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

* [Bug middle-end/111625] valgrind error with ./gcc.dg/bitint-8.c
  2023-09-28 10:26 [Bug c/111625] New: valgrind error with ./gcc.dg/bitint-8.c dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2023-09-29 14:45 ` jakub at gcc dot gnu.org
@ 2023-09-30  9:34 ` cvs-commit at gcc dot gnu.org
  2023-09-30 10:08 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-30  9:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111625

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:09b512466ce302833d1624045fc5fe5afe040f58

commit r14-4349-g09b512466ce302833d1624045fc5fe5afe040f58
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Sep 30 11:28:44 2023 +0200

    lowerbitint: Fix 2 bitint lowering bugs [PR111625]

    This patch fixes 2 issues.  One is when we want to get address of
    an uninitialized large/huge bitint SSA_NAME for
multiplication/division/modulo
    or conversion to floating point (binary or decimal), the code just creates
    an uninitialized limb sized variable and passes address of that, but I
forgot
    to initialize *prec in that case, so it invoked UB at compile time rather
    than at runtime.  As it is UB, we could use anything valid as precision
there,
    say 2 bits for signed, 1 bit for unsigned as smallest possible set of
values,
    or full bitint precision as full random value.  Though, because we only
pass
    address to a single limb, I think it is best to pass the bitsize of the
limb.

    And the other issue is that when ranger in range_to_prec finds some range
    is undefined_p (), it will assert {lower,upper}_bound () method isn't
called
    on it, but we were.  So, the patch adjusts range_to_proc to treat it like
    the !optimized case, full bitint precision.

    2023-09-30  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/111625
            PR middle-end/111637
            * gimple-lower-bitint.cc (range_to_prec): Use prec or -prec if
            r.undefined_p ().
            (bitint_large_huge::handle_operand_addr): For uninitialized
operands
            use limb_prec or -limb_prec precision.

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

* [Bug middle-end/111625] valgrind error with ./gcc.dg/bitint-8.c
  2023-09-28 10:26 [Bug c/111625] New: valgrind error with ./gcc.dg/bitint-8.c dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2023-09-30  9:34 ` cvs-commit at gcc dot gnu.org
@ 2023-09-30 10:08 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-09-30 10:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111625

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed now.

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

end of thread, other threads:[~2023-09-30 10:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28 10:26 [Bug c/111625] New: valgrind error with ./gcc.dg/bitint-8.c dcb314 at hotmail dot com
2023-09-28 10:38 ` [Bug c/111625] " dcb314 at hotmail dot com
2023-09-29 14:42 ` [Bug middle-end/111625] " jakub at gcc dot gnu.org
2023-09-29 14:45 ` jakub at gcc dot gnu.org
2023-09-30  9:34 ` cvs-commit at gcc dot gnu.org
2023-09-30 10:08 ` jakub at gcc dot gnu.org

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