The Toronto stock market registered a solid gain Tuesday as investors continued to pick up beaten-down mining stocks and took in two disappointing earnings reports from the retail sector.The S&P/TSX composite index was up 66.51 points to 12,275.38.The Canadian dollar was ahead 0.22 of a cent at 94.92 cents US amid data showing that Canadian housing starts came in at an annualized rate of 199,586 units in June, a decrease from 204,616 in May. That was much better than the reading of 190,000 starts that analysts had been expecting.U.S. indexes also advanced as Alcoa Inc. (NYSE:AA), the first Dow component to report its second-quarter results, failed to benefit from quarterly earnings which beat revenue and profit expectations. Alcoa said after the close of markets Monday that it earned seven cents a share, a penny better than forecast. Revenue came in at $5.85 billion, surpassing expectations of $5.8 billion. However, its stock lost early momentum and slipped four cents to US$7.87.“Does anyone really care about an aluminum company?” said Gareth Watson, vice-president at Richardson GMP Ltd. “Right now the market’s attention is not on base metal stocks. So even if it has a good report, I think people are putting their money into interest sensitive and dividend yielding stocks and if they are getting cyclical, they’re doing it in other areas such as industrials.”The Dow Jones industrials advanced 80.26 points 15,304.95, the Nasdaq gained 18.87 points to 3,503.7 and the S&P 500 index was ahead 12.01 points at 1,652.47.Meanwhile, executives at smartphone maker BlackBerry (TSX:BB) were in investor crosshairs as the company held its annual meeting.BlackBerry reported a loss for its most recent quarter, when most analysts had expected it to turn a profit. At the meeting, chief executive Thorsten Heins encouraged shareholders to remain patient as the company pushes ahead with a plan to become profitable again. Heins says it’s going to take time, and just how long is unpredictable due to the volatile smartphone industry. Its stock was up 14 cents to $10.24, well off its 52-week high of $18.49.Shares in Jean Coutu Group (TSX:PJC.A) fell 67 cents to $17.14 after the pharmacy retailer said it earned $108.6 million or 51 cents per share, down from $397.3 million or $1.81 per share a year ago, mainly due to much smaller gains from the sale of shares in U.S. pharmacy chain Rite Aid.Excluding one-time items, earnings were $54.2 million or 26 cents per share, which matched expectations. Revenue was almost unchanged from a year ago at $681.6 million, which missed forecasts for more than $702 million.Shares of Alimentation Couche-Tard Inc. (TSX:ATD.B) were also lower after it reported a large year-over-year increase in net earnings in the fourth quarter, but fell short of analyst estimates on adjusted profit.Excluding one-time items, the convenience store and gas station operator said it earned 61 cents US per share, well below expectations of 77 cents per share. Its shares were down $3.72 or 6.06 per cent at $57.67.Mining stocks benefited from bargain hunting for a second day. Falling demand for resources has pushed the TSX base metals sector down 32 per cent so far this year. The gold sector has fared much worse, down 47 per cent year to date as the Federal Reserve signalled it could start tapering its economic stimulus program of bond purchases later in the year while inflationary pressures remain tame.But Watson said “those factors aren’t there anymore so longer term as an investment there is no reason for people to get into the sector. “And for those who want to do short term trading on the actual bullion and equities, go right ahead. But there is still a significant risk gold prices will move lower here.”On Tuesday, the base metals sector was ahead 2.4 per cent even as copper prices fell further on demand concerns, with the September contract down three cents to US$3.06 a pound. HudBay Minerals (TSX:HBM) climbed 16 cents to C$6.80 and Teck Resources (TSX:TCK.B) advanced 93 cents to $22.11.Railway stocks advanced alongside mining stocks after losing some ground Monday amid questions about the transport of crude oil in the wake of a derailment over the weekend in Lac-Megantic, Que., killing at least 13 people and leaving nearly 40 more missing. Canadian National Railway (TSX:CNR) rose 90 cents to $103.63 while Canadian Pacific (TSX:CP) climbed $1.61 to $128.30.The gold sector rose 0.7 per cent as gold prices rose slightly with the August bullion contract in New York ahead $11 to US$1,245.90. Eldorado Gold (TSX:ELD) gained 17 cents to C$6.40 while Goldcorp Inc. (TSX:G) ran ahead 42 cents to $25.33.The August crude oil contract on the New York Mercantile Exchange shook off early losses to advance 29 cents to US$103.43 a barrel and the energy sector swung from negative ground to advance 0.7.Canadian Oil Sands (TSX:COS) fell 89 cents to C$19.88 while Imperial Oil (TSX:IMO) improved by 64 cents to $42.42.In other economic news, the International Monetary Fund upgraded Canada’s growth expectations for this year to 1.7 per cent from 1.5 per cent, but warned that overall global conditions remain uneven, weak and perilous.The IMF expects growth around the world will barely top three per cent this year, moderately lower than previously thought, and only start showing signs of life at 3.8 per cent in 2014.