G-flux in F-theory and algebraic cycles