https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69151
Bug ID: 69151 Summary: missing docs for H8/3000 monitor/OS_Task attributes and related breakage in -mexr/-mno-exr options Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: sandra at gcc dot gnu.org Target Milestone: --- In reviewing the current state of PR1078, I found that there is no documentation for the H8/3000 function attributes "monitor" and "OS_Task". The "monitor" attribute is mentioned in invoke.texi, though: @item -mexr @opindex mexr Extended registers are stored on stack before execution of function with monitor attribute. Default option is @option{-mexr}. This option is valid only for H8S targets. @item -mno-exr @opindex mno-exr Extended registers are not stored on stack before execution of function with monitor attribute. Default option is @option{-mno-exr}. This option is valid only for H8S targets. Besides needing markup fixes and copy-editing, this text is totally confusing: *both* of these behaviors cannot be the default. Trying to figure this out from the code, in "monitor_prologue" in h8300.md I see: ... else if (TARGET_H8300S && TARGET_NEXR ) return "mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr"; else if (TARGET_H8300S && TARGET_NEXR && TARGET_NORMAL_MODE) return "subs\\t#2,er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr"; ... The second clause is clearly dead code. I think there is a mistake in logic here, and that a target expert needs to figure out what the intended behavior is and correct both the implementation and documentation.