Bug 208667
Summary: | gcc "used" attribute has no effect on local-scope static variables | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jeremy Fitzhardinge <jeremy> | ||||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||||
Status: | CLOSED NOTABUG | QA Contact: | |||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | 6 | ||||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | i386 | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2006-09-30 12:01:30 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
Description
Jeremy Fitzhardinge
2006-09-29 23:18:28 UTC
Created attachment 137451 [details]
C source
As a workaround, I'm adding asm("" : : "m" (bar)) to force a reference to the variable. Unfortunately, this seems to provoke some other bug when I use it in the kernel; I get references to labels which don't exist. I'll try to winnow something down to file a separate bug. Created attachment 137452 [details]
.s output file I get
I don't think that's a bug, local statics are very different from global ones. For global statics you know their name and can reference it from asm, for local statics if you don't reference them, you can't guess their name. Also, this is nothing Fedora gcc specific, upstream GCC behaves the same way, so if you insist this is a GCC bug, you should file it to upstream instead (http://gcc.gnu.org/bugzilla/). As I said in the original report: "I'm actually using this in the kernel to emit things into a section, so it doesn't matter what actual name the variable gets." I want to emit a record for each BUG() into the __bug_table section; since BUG is necessarily used within code, everything that happens within it needs to have some kind of local scope. I thought I'd report it here in case there was some local change, but I'll report it upstream. |