public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/112347] [14 regression] ICE on jemalloc-5.3.0: Segmentation fault around convert_for_assignment()
Date: Fri, 03 Nov 2023 09:54:09 +0000	[thread overview]
Message-ID: <bug-112347-4-4B7BY6rCN9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112347-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 from David Binderman <dcb314 at hotmail dot com> ---
I have been trying to get this C++ code to produce the new warning:

#include <cstdlib>

struct S
{
        int a[ 10];
        float * b[ 20];
};

extern void g( S * ps);

void f( int n)
{
        S * ps = (S *) calloc( sizeof( S), 1);
        g( ps);

        S * ps2 = (S *) calloc( 1, sizeof( S));
        g( ps2);

        S * ps3 = (S *) calloc( 1, sizeof( S) / 2);
        g( ps3);
}

$ ~/gcc/results/bin/g++ -g -O2 -Wall -Wextra -Walloc-size -c nov2b.cc
cc1plus: warning: command-line option ‘-Walloc-size’ is valid for C/ObjC but
not for C++
nov2b.cc: In function ‘void f(int)’:
nov2b.cc:12:13: warning: unused parameter ‘n’ [-Wunused-parameter]
   12 | void f( int n)
      |         ~~~~^
$ ~/gcc/results/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/dcb38/gcc/results/bin/g++
COLLECT_LTO_WRAPPER=/home/dcb38/gcc/results.20231102.asan.ubsan/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../trunk.year/configure
--prefix=/home/dcb38/gcc/results.20231102.asan.ubsan --disable-multilib
--disable-bootstrap --with-build-config=bootstrap-asan
--with-build-config=bootstrap-ubsan --with-pkgversion=01c18f58d37865d5
--enable-checking=df,extra,fold,rtl,yes --enable-languages=c,c++,fortran
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231102 (experimental) (01c18f58d37865d5) 
$ 

I think calloc is available in C++, so the warning is wrong.

  parent reply	other threads:[~2023-11-03  9:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02  9:49 [Bug c/112347] New: " slyfox at gcc dot gnu.org
2023-11-02  9:53 ` [Bug c/112347] " slyfox at gcc dot gnu.org
2023-11-02 10:00 ` slyfox at gcc dot gnu.org
2023-11-02 10:10 ` rguenth at gcc dot gnu.org
2023-11-02 10:24 ` muecker at gwdg dot de
2023-11-02 12:22 ` muecker at gwdg dot de
2023-11-02 12:24 ` muecker at gwdg dot de
2023-11-02 12:27 ` muecker at gwdg dot de
2023-11-02 12:33 ` dcb314 at hotmail dot com
2023-11-02 13:33 ` slyfox at gcc dot gnu.org
2023-11-02 13:55 ` cvs-commit at gcc dot gnu.org
2023-11-02 16:24 ` dcb314 at hotmail dot com
2023-11-02 18:58 ` muecker at gwdg dot de
2023-11-03  7:53 ` muecker at gwdg dot de
2023-11-03  9:54 ` dcb314 at hotmail dot com [this message]
2023-11-03 11:02 ` muecker at gwdg dot de
2023-11-03 11:06 ` dcb314 at hotmail dot com
2023-11-03 11:22 ` muecker at gwdg dot de
2023-11-03 11:55 ` sjames at gcc dot gnu.org
2023-11-03 12:12 ` muecker at gwdg dot de
2023-11-03 12:15 ` sjames at gcc dot gnu.org
2023-11-03 12:17 ` muecker at gwdg dot de
2023-11-04  8:22 ` dcb314 at hotmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112347-4-4B7BY6rCN9@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).