GCC Bugzilla will be upgraded from version 4.4.9 to 5.0rc3 on Saturday, April 25, starting around 17:00 UTC. The upgrade process should only last a few minutes. Check bug 64968 for details.
Bug 36392 - gcc doesn't warn if a static recursive function is unused
gcc doesn't warn if a static recursive function is unused
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c
4.2.4
: P3 normal
: 4.3.0
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-30 14:12 UTC by Claudio Saavedra
Modified: 2008-05-30 14:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Claudio Saavedra 2008-05-30 14:12:10 UTC
Take the following example:

  static 
  int a (void)
  {
	return a();
  }

  int 
  main ()
  {
	return 0;
  }

GCC doesn't warn that a() is an unused function.

This is problematic if you remove all calls to a() from your code. Although a() uses itself, GCC should warn that no other function is using it, so that the user could remove it.
Comment 1 Andrew Pinski 2008-05-30 14:56:24 UTC
This has been fixed in 4.3.0:
t.c:3: warning: 'a' defined but not used