public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Fredrik Hederstierna <fredrik.hederstierna@verisure.com>
To: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Question unused function parameter data garbage collection
Date: Mon, 12 Sep 2022 11:21:51 +0000	[thread overview]
Message-ID: <HE1PR1001MB11801D262FEE4C78ACE6F8BDEF449@HE1PR1001MB1180.EURPRD10.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 753 bytes --]

Hi,

We have a function that does not used an in-parameter, simplified example:

void test_unused_string_param_gc(const char* unused)
{
   // empty
}

Though when we have calls to this function, the arguments are still put in the memory, causing unnecessary flash memory usage for 'dead parameters'.

Example if having a call (from another file) as

      test_unused_string_param_gc("This string is not garbage-collected?");

Then this string will still be added to our finally build binary?

We compile with -Os, and have tried different flags to try get rid of this dead parameter data,
do anyone know if this is the expected behavior and why? Or if we are missing any optimization flags, like LTO etc?

Best Regards,
Fredrik


             reply	other threads:[~2022-09-12 11:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 11:21 Fredrik Hederstierna [this message]
2022-09-12 12:30 ` Richard Biener
2022-09-12 14:48   ` Martin Jambor

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=HE1PR1001MB11801D262FEE4C78ACE6F8BDEF449@HE1PR1001MB1180.EURPRD10.PROD.OUTLOOK.COM \
    --to=fredrik.hederstierna@verisure.com \
    --cc=gcc@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).