[Bug c/83748] New: Local variables not aligned to word boundary

sbansal at ciena dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 9 06:16:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83748

            Bug ID: 83748
           Summary: Local variables not aligned to word boundary
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbansal at ciena dot com
  Target Milestone: ---

While migrating from 3.4.5 to 4.8.1 tool chain, seeing issues with unaligned
address.

The same code did not produce unaligned address in 3.4.5 but in 4.8.1 seeing
such an issue.

Below variables are declared in a function body :

377   FACOTMn_parms_t                   *OTMnData = (FACOTMn_parms_t * )data;
378   TSM_desc_t                        nvsFacData;
379   CS_result_t                       rc = CS_SSTP_rc;  
380   uint8                             *otmn_ptr = NULL, *sc_ptr = NULL;
381   uint8                             *tr_ptr = NULL, *och_ptr = NULL,
*faccfg_ptr = NULL;
382   uint8                             slot = 0;
383   uint8                             port = 0;
384   ALA_obj_t                         object = ALA_nil_obj;
385   uint16                            index = 0;
386   GBB_rc_t                          gbbrc = GBB_SUCCESS_rc;
387   GBB_FAC_ROLE_t                    facRole = GBB_FAC_ROLE_UNKNOWN;
388   ALA_eqpt_t                        plug_type, otm_eqpt;
389   GBB_DISP_BasicPortInfoList_t      portInfoList;
390   CFGM_PecInfo_t                    PecInfo;
391   ome_CardCfgPxfp_t                 xfpPecInfo;
392   ome_CardCfgPsfp_t                 sfpPecInfo;
393   ome_CardCfgPcfp_t                 cfpPecInfo;
394   float                             *wvlgthMin, *wvlgthMax;
395   OCH_wavelength_t                  *wvlgthSpacing;
396   TSM_service_mgr_t                 tsam;
397   CS_internal_AID_t                 slotAID;
398   uint8                             numObj;
399   uint8                             indx;
400   uint8                             scIndx = 0; 
401   CS_AID_t                          tempAID;
402   uint8                             assignedTS = 0;
403   ODUn_sbf_parms_t                  FwParms;
404   TSM_desc_t                        oduFacData;  
405   TSM_featInfo_t                    featInfo;
406   GBB_SERV_TYPE_t                   servType;
407   boolean                           isQSFP = FALSE;

Seeing issues when accessing elements of xfpPecInfo, sfpPecInfo and cfpPecInfo
and deference them.

However, when forcefully aligned the addresses to 4 byte boundary for all these
three, there was no unaligned addresses created such as :
  ome_CardCfgPxfp_t                 xfpPecInfo __attribute__((aligned(4)));
  ome_CardCfgPsfp_t                 sfpPecInfo __attribute__((aligned(4)));
  ome_CardCfgPcfp_t                 cfpPecInfo __attribute__((aligned(4)));



Please suggest.

Let me know if more information is needed.


More information about the Gcc-bugs mailing list