User account creation filtered due to spam.

Bug 36392 - gcc doesn't warn if a static recursive function is unused
Summary: gcc doesn't warn if a static recursive function is unused
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.2.4
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
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