Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 402
    • Issues 402
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2010
Closed
Open
Created Sep 28, 2009 by Robert Bernecky@rbeDeveloper

AS fails to simplify X-(X-1) if -extrema enabled

Bugzilla Link 565
Created on Sep 29, 2009 00:18
Resolution FIXED
Resolved on Nov 06, 2009 23:27
Version 1.00beta
OS Linux
Architecture PC
Attachments prdreverse2.sac

Extended Description

Created an attachment (id=573)
Source code to reproduce fault
If compiled with:
sac2c -extrema -doswlf -nowlf prdreverse2.sac -b11 
we get this fold WL generated:
_pinl_205_res = with {
        (_flatg_695 <= _pinl_203_iv=[_pinl_206__eat_15] < _flatg_696)
        {
          _dup_715__pinl_207__ea_94_res = _accu_( _pinl_203_iv);
          _ivexp_1010__dup_850__ivexp_840__dup_730__pinl_178__flat_10 = _sub_SxS_( 49, _pinl_206__eat_15);
          _ivexp_1097__dup_1067__ivexp_843__dup_745__pinl_148__flat_10 = _sub_SxS_( 49, _ivexp_1010__dup_850__ivexp_840__dup_730__pinl_178__flat_10);
          _dup_717__pinl_213___flat_69 = _add_SxS_( _dup_715__pinl_207__ea_94_res, _ivexp_1097__dup_1067__ivexp_843__dup_745__pinl_148__flat_10);
        } : _dup_717__pinl_213___flat_69 ;
 } :
      fold( ScalarArith::+, _pinl_118__flat_3);
The two substract operations should be simplified by AS, but are not.
The problem arises from _attachextrema_ code inserted by -extrema:
 _pinl_205_res = with {
        (_flatg_695 <= _pinl_203_iv=[_pinl_206__eat_15] < _flatg_696 genwidth [ 50 ])
        {
          _ivexi_705 = _attachextrema_( _pinl_203_iv, _flatg_695, _ivexp_954);
          _dup_715__pinl_207__ea_94_res = _accu_( _ivexi_705);
          _dup_847__ivexi_729__pinl_177_i = _attachextrema_( _pinl_206__eat_15, _pinl_118__flat_3, _ivexi_743___flatg_698);
          _ivexp_1010__dup_850__ivexp_840__dup_730__pinl_178__flat_10 = _sub_SxS_( 49, _dup_847__ivexi_729__pinl_177_i);
          _dup_850__ivexp_840__dup_730__pinl_178__flat_10 = _attachextrema_( _ivexp_1010__dup_850__ivexp_840__dup_730__pinl_178__flat_10, _pinl_118__flat_3, _ivexi_743___flatg_698);
          _dup_851___pinl_178__flat_10 = _attachextrema_( _dup_850__ivexp_840__dup_730__pinl_178__flat_10, _pinl_118__flat_3, _ivexi_743___flatg_698);
          _ivexp_1007 = _attachextreman_( _dup_851___pinl_178__flat_10, _flatg_695, _ivexp_954);
          _dup_1066__ivexi_744__pinl_147_i = _attachextrema_( _ivexp_1007, _pinl_118__flat_3, _ivexi_743___flatg_698);
          _ivexp_1097__dup_1067__ivexp_843__dup_745__pinl_148__flat_10 = _sub_SxS_( 49, _dup_1066__ivexi_744__pinl_147_i);
          _dup_1067__ivexp_843__dup_745__pinl_148__flat_10 = _attachextrema_( _ivexp_1097__dup_1067__ivexp_843__dup_745__pinl_148__flat_10, _pinl_118__flat_3, _ivexi_743___flatg_698);
          _dup_1068___pinl_148__flat_10 = _attachextrema_( _dup_1067__ivexp_843__dup_745__pinl_148__flat_10, _pinl_118__flat_3, _ivexi_743___flatg_698);
          _dup_1069__ivexp_955 = _attachextreman_( _dup_1068___pinl_148__flat_10, _flatg_695, _ivexp_954);
          _dup_717__pinl_213___flat_69 = _add_SxS_( _dup_715__pinl_207__ea_94_res, _dup_1069__ivexp_955);
        } : _dup_717__pinl_213___flat_69 ;
 } :
      fold( ScalarArith::+, _pinl_118__flat_3);
I'll have a go at fixing this in the morning.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking