This is because the Building Material's Intersection Priority
of the Wall is stronger than (or equal to) the Roof, so the Wall is cutting the Roof before the Trim Elements to Roof/Shell operation is executed. Try changing the Building Material's Intersection Priority for the Wall or Roof, or use Solid Element Operation
instead of Trim Elements to Roof/Shell.
You should add a Signature to your Profile (click the Profile button near the top of this page) with your ArchiCAD version and operating system (see mine for an example) for more accurate help in this forum.